mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Move block-storage-related logic to ChainstateManager
Separate the notion of which blocks are stored on disk, and what data is in our block index, from what tip a chainstate might be able to get to. We can use chainstate-agnostic data to determine when to store a block on disk (primarily, an anti-DoS set of criteria) and let the chainstates figure out for themselves when a block is of interest for being a candidate tip. Note: some of the invariants in CheckBlockIndex are modified, but more work is needed (ie to move CheckBlockIndex to ChainstateManager, as most of what CheckBlockIndex is doing is checking the consistency of the block index, which is outside of Chainstate).
This commit is contained in:
@@ -35,9 +35,9 @@ FUZZ_TARGET_INIT(load_external_block_file, initialize_load_external_block_file)
|
||||
// Corresponds to the -reindex case (track orphan blocks across files).
|
||||
FlatFilePos flat_file_pos;
|
||||
std::multimap<uint256, FlatFilePos> blocks_with_unknown_parent;
|
||||
g_setup->m_node.chainman->ActiveChainstate().LoadExternalBlockFile(fuzzed_block_file, &flat_file_pos, &blocks_with_unknown_parent);
|
||||
g_setup->m_node.chainman->LoadExternalBlockFile(fuzzed_block_file, &flat_file_pos, &blocks_with_unknown_parent);
|
||||
} else {
|
||||
// Corresponds to the -loadblock= case (orphan blocks aren't tracked across files).
|
||||
g_setup->m_node.chainman->ActiveChainstate().LoadExternalBlockFile(fuzzed_block_file);
|
||||
g_setup->m_node.chainman->LoadExternalBlockFile(fuzzed_block_file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user