1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
crate::ix!();
/**
| Helper for findBlock to selectively return
| pieces of block data. If block is found, data
| will be returned by setting specified output
| variables. If block is not found, output
| variables will keep their previous values.
*/
pub struct FoundBlock {
hash: *mut u256,
height: *mut i32,
time: *mut i64,
max_time: *mut i64,
mtp_time: *mut i64,
in_active_chain: *mut bool,
next_block: Amo<FoundBlock>,
data: Amo<Block>,
found: RefCell<bool>,
}
impl Default for FoundBlock {
fn default() -> Self {
Self {
hash: null_mut(),
height: null_mut(),
time: null_mut(),
max_time: null_mut(),
mtp_time: null_mut(),
in_active_chain: null_mut(),
next_block: amo_none(),
data: amo_none(),
found: RefCell::new(false),
}
}
}
impl FoundBlock {
pub fn hash(&mut self, hash: &mut u256) -> &mut FoundBlock {
todo!();
/*
m_hash = &hash; return *this;
*/
}
pub fn height(&mut self, height: &mut i32) -> &mut FoundBlock {
todo!();
/*
m_height = &height; return *this;
*/
}
pub fn time(&mut self, time: &mut i64) -> &mut FoundBlock {
todo!();
/*
m_time = &time; return *this;
*/
}
pub fn max_time(&mut self, max_time: &mut i64) -> &mut FoundBlock {
todo!();
/*
m_max_time = &max_time; return *this;
*/
}
pub fn mtp_time(&mut self, mtp_time: &mut i64) -> &mut FoundBlock {
todo!();
/*
m_mtp_time = &mtp_time; return *this;
*/
}
/**
| Return whether block is in the active
| (most-work) chain.
|
*/
pub fn in_active_chain(&mut self, in_active_chain: &mut bool) -> &mut FoundBlock {
todo!();
/*
m_in_active_chain = &in_active_chain; return *this;
*/
}
/**
| Return next block in the active chain
| if current block is in the active chain.
|
*/
pub fn next_block(&mut self, next_block: &FoundBlock) -> &mut FoundBlock {
todo!();
/*
m_next_block = &next_block; return *this;
*/
}
/**
| Read block data from disk. If the block
| exists but doesn't have data (for example
| due to pruning), the CBlock variable will
| be set to null.
*/
pub fn data(&mut self, data: &mut Block) -> &mut FoundBlock {
todo!();
/*
m_data = &data; return *this;
*/
}
}