diff options
author | James O'Beirne <james.obeirne@pm.me> | 2021-10-28 15:15:10 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2021-12-13 13:45:22 -0500 |
commit | d0c6e61f5dd3b6af818459d9d03b7ba316c5a3f7 (patch) | |
tree | f4067d5f4bbd4f5f673ee896f1a11f9d3e243d5f /src/test | |
parent | af4275e8dbde0fd85b590175f1e932164762d741 (diff) |
validation: don't modify genesis during snapshot load
Avoid modifying the genesis block index entry during snapshot load. This
is because, in a future change that fixes LoadBlockIndex for UTXO
snapshots, we detect block index entries that are reliant on
assumed-valid ancestors and treat them specially.
Since the genesis block doesn't have BLOCK_VALID_SCRIPTS, it would be
erroneously marked BLOCK_ASSUMED_VALID during snapshot load if we didn't
skip it here. This would cause a "setBlockIndexCandidates() empty"
assertion to be tripped since all block index entries would be marked
assume-valid due to genesis, which is never re-validated.
There's probably no good reason to modify the genesis block index entry
during snapshot load anyway...
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/validation_chainstatemanager_tests.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp index be9e05a65e..ca38f9d5fa 100644 --- a/src/test/validation_chainstatemanager_tests.cpp +++ b/src/test/validation_chainstatemanager_tests.cpp @@ -232,6 +232,9 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_activate_snapshot, TestChain100Setup) *chainman.ActiveChainstate().m_from_snapshot_blockhash, *chainman.SnapshotBlockhash()); + // Ensure that the genesis block was not marked assumed-valid. + BOOST_CHECK(!chainman.ActiveChain().Genesis()->IsAssumedValid()); + const AssumeutxoData& au_data = *ExpectedAssumeutxo(snapshot_height, ::Params()); const CBlockIndex* tip = chainman.ActiveTip(); |