mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Move CheckBlockIndex() from Chainstate to ChainstateManager
Also rewrite CheckBlockIndex() to perform tests on all chainstates. This increases sanity-check coverage, as any place in our code where we were invoke CheckBlockIndex() on a single chainstate will now invoke the sanity checks on all chainstates. This change also tightens up the checks on setBlockIndexCandidates and mapBlocksUnlinked, to more precisely match what we aim for even in the presence of assumed-valid blocks.
This commit is contained in:
@@ -706,13 +706,6 @@ public:
|
||||
/** Find the last common block of this chain and a locator. */
|
||||
const CBlockIndex* FindForkInGlobalIndex(const CBlockLocator& locator) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
/**
|
||||
* Make various assertions about the state of the block index.
|
||||
*
|
||||
* By default this only executes fully when using the Regtest chain; see: m_options.check_block_index.
|
||||
*/
|
||||
void CheckBlockIndex();
|
||||
|
||||
/** Load the persisted mempool from disk */
|
||||
void LoadMempool(const fs::path& load_path, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen);
|
||||
|
||||
@@ -927,6 +920,13 @@ public:
|
||||
const uint256& AssumedValidBlock() const { return *Assert(m_options.assumed_valid_block); }
|
||||
kernel::Notifications& GetNotifications() const { return m_options.notifications; };
|
||||
|
||||
/**
|
||||
* Make various assertions about the state of the block index.
|
||||
*
|
||||
* By default this only executes fully when using the Regtest chain; see: m_options.check_block_index.
|
||||
*/
|
||||
void CheckBlockIndex();
|
||||
|
||||
/**
|
||||
* Alias for ::cs_main.
|
||||
* Should be used in new code to make it easier to make ::cs_main a member
|
||||
|
||||
Reference in New Issue
Block a user