HomePhabricator

test: Load genesis block to allow flush

Description

test: Load genesis block to allow flush

Summary:
This is needed to turn globals into member variables. Otherwise, this
will lead to issues:

runtime error: reference binding to null pointer of type 'CBlockFileInfo'
    #0 in std::vector<CBlockFileInfo, std::allocator<CBlockFileInfo> >::operator[](unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:1046:2
    #1 in BlockManager::FlushBlockFile(bool, bool) src/node/blockstorage.cpp:540:47
    #2 in CChainState::FlushStateToDisk(BlockValidationState&, FlushStateMode, int) src/validation.cpp:2262:28
    #3 in CChainState::ResizeCoinsCaches(unsigned long, unsigned long) src/validation.cpp:4414:15
    #4 in validation_chainstate_tests::validation_chainstate_resize_caches::test_method() src/test/validation_chainstate_tests.cpp:66:12

This is a partial backport of core#23974
https://github.com/bitcoin/bitcoin/pull/23974/commits/fad381b2f8e1beb18f748fbeb820e63545b9b0fd

Depends on D12512

Test Plan: ninja check

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D12513

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jan 5 2022, 15:25
PiRKCommitted on Nov 17 2022, 10:06
PiRKPushed on Nov 17 2022, 10:07
Reviewer
Restricted Project
Differential Revision
D12513: test: Load genesis block to allow flush
Parents
rABCd218c9c0304e: Move blockstorage-related unload to BlockManager::Unload
Branches
Unknown
Tags
Unknown