mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#27746: Rework validation logic for assumeutxo
a733dd79e2Remove unused function `reliesOnAssumedValid` (Suhas Daftuar)d4a11abb19Cache block index entry corresponding to assumeutxo snapshot base blockhash (Suhas Daftuar)3556b85022Move CheckBlockIndex() from Chainstate to ChainstateManager (Suhas Daftuar)0ce805b632Documentation improvements for assumeutxo (Ryan Ofsky)768690b7ceFix initialization of setBlockIndexCandidates when working with multiple chainstates (Suhas Daftuar)d43a1f1a2fTighten requirements for adding elements to setBlockIndexCandidates (Suhas Daftuar)d0d40ea9a6Move block-storage-related logic to ChainstateManager (Suhas Daftuar)3cfc75366etest: Clear block index flags when testing snapshots (Suhas Daftuar)272fbc370cUpdate CheckBlockIndex invariants for chains based on an assumeutxo snapshot (Suhas Daftuar)10c05710ceAdd wrapper for adding entries to a chainstate's block index candidates (Suhas Daftuar)471da5f6e7Move block-arrival information / preciousblock counters to ChainstateManager (Suhas Daftuar)1cfc887d00Remove CChain dependency in node/blockstorage (Suhas Daftuar)fe86a7cd48Explicitly track maximum block height stored in undo files (Suhas Daftuar) Pull request description: This PR proposes a clean up of the relationship between block storage and the chainstate objects, by moving the decision of whether to store a block on disk to something that is not chainstate-specific. Philosophically, the decision of whether to store a block on disk is related to validation rules that do not require any UTXO state; for anti-DoS reasons we were using some chainstate-specific heuristics, and those have been reworked here to achieve the proposed separation. This PR also fixes a bug in how a chainstate's `setBlockIndexCandidates` was being initialized; it should always have all the HAVE_DATA block index entries that have more work than the chain tip. During startup, we were not fully populating `setBlockIndexCandidates` in some scenarios involving multiple chainstates. Further, this PR establishes a concept that whenever we have 2 chainstates, that we always know the snapshotted chain's base block and the base block's hash must be an element of our block index. Given that, we can establish a new invariant that the background validation chainstate only needs to consider blocks leading to that snapshotted block entry as potential candidates for its tip. As a followup I would imagine that when writing net_processing logic to download blocks for the background chainstate, that we would use this concept to only download blocks towards the snapshotted entry as well. ACKs for top commit: achow101: ACKa733dd79e2jamesob: reACKa733dd79e2([`jamesob/ackr/27746.5.sdaftuar.rework_validation_logic`](https://github.com/jamesob/bitcoin/tree/ackr/27746.5.sdaftuar.rework_validation_logic)) Sjors: Code review ACKa733dd79e2. ryanofsky: Code review ACKa733dd79e2. Just suggested changes since the last review. There are various small things that could be followed up on, but I think this is ready for merge. Tree-SHA512: 9ec17746f22b9c27082743ee581b8adceb2bd322fceafa507b428bdcc3ffb8b4c6601fc61cc7bb1161f890c3d38503e8b49474da7b5ab1b1f38bda7aa8668675
This commit is contained in:
@@ -35,9 +35,9 @@ FUZZ_TARGET(load_external_block_file, .init = initialize_load_external_block_fil
|
||||
// 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