Skip to content

Commit fbae8a2

Browse files
MarcoFalkeJaredTate
authored andcommitted
test: Load genesis block to allow flush
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 (cherry picked from commit fad381b)
1 parent 012ba47 commit fbae8a2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/test/validation_chainstate_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
4343
c1.InitCoinsDB(
4444
/* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
4545
WITH_LOCK(::cs_main, c1.InitCoinsCache(1 << 23));
46+
BOOST_REQUIRE(c1.LoadGenesisBlock()); // Need at least one block loaded to be able to flush caches
4647

4748
// Add a coin to the in-memory cache, upsize once, then downsize.
4849
{

0 commit comments

Comments
 (0)