MCPcopy Create free account
hub / github.com/ElementsProject/elements / FoundBlock

Class FoundBlock

src/interfaces/chain.h:45–70  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

43//! found, data will be returned by setting specified output variables. If block
44//! is not found, output variables will keep their previous values.
45class FoundBlock
46{
47public:
48 FoundBlock& hash(uint256& hash) { m_hash = &hash; return *this; }
49 FoundBlock& height(int& height) { m_height = &height; return *this; }
50 FoundBlock& time(int64_t& time) { m_time = &time; return *this; }
51 FoundBlock& maxTime(int64_t& max_time) { m_max_time = &max_time; return *this; }
52 FoundBlock& mtpTime(int64_t& mtp_time) { m_mtp_time = &mtp_time; return *this; }
53 //! Return whether block is in the active (most-work) chain.
54 FoundBlock& inActiveChain(bool& in_active_chain) { m_in_active_chain = &in_active_chain; return *this; }
55 //! Return next block in the active chain if current block is in the active chain.
56 FoundBlock& nextBlock(const FoundBlock& next_block) { m_next_block = &next_block; return *this; }
57 //! Read block data from disk. If the block exists but doesn't have data
58 //! (for example due to pruning), the CBlock variable will be set to null.
59 FoundBlock& data(CBlock& data) { m_data = &data; return *this; }
60
61 uint256* m_hash = nullptr;
62 int* m_height = nullptr;
63 int64_t* m_time = nullptr;
64 int64_t* m_max_time = nullptr;
65 int64_t* m_mtp_time = nullptr;
66 bool* m_in_active_chain = nullptr;
67 const FoundBlock* m_next_block = nullptr;
68 CBlock* m_data = nullptr;
69 mutable bool found = false;
70};
71
72//! Interface giving clients (wallet processes, maybe other analysis tools in
73//! the future) ability to access to the chain state, receive notifications,

Callers 15

LoadToWalletMethod · 0.85
RescanFromTimeMethod · 0.85
GetKeyBirthTimesMethod · 0.85
ComputeTimeSmartMethod · 0.85
AttachChainMethod · 0.85
tryGetTxStatusMethod · 0.85
importprunedfundsFunction · 0.85
importwalletFunction · 0.85
dumpwalletFunction · 0.85
importmultiFunction · 0.85

Calls

no outgoing calls

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68