diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2023-03-27 15:09:23 -0400 |
---|---|---|
committer | Martin Zumsande <mzumsande@gmail.com> | 2023-03-27 15:47:32 -0400 |
commit | f8abcb3e3b2e731c002ec88f7559c21e26a2c079 (patch) | |
tree | ec075ac60dfb794e7a234e910d1a12e8edb7e02c /src/test | |
parent | b759cefe936ed3991633acff215ea1dcec5ece28 (diff) |
test: Fix intermittent failure in ChainStateManager tests
Before wiping the ChainStateManager, the validationinterface
queue must be drained to avoid accessing deleted memory.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/validation_chainstatemanager_tests.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp index 688aafdd46..edc7e4b70a 100644 --- a/src/test/validation_chainstatemanager_tests.cpp +++ b/src/test/validation_chainstatemanager_tests.cpp @@ -367,10 +367,13 @@ struct SnapshotTestSetup : TestChain100Setup { BOOST_TEST_MESSAGE("Simulating node restart"); { - LOCK(::cs_main); for (Chainstate* cs : chainman.GetAll()) { + LOCK(::cs_main); cs->ForceFlushStateToDisk(); } + // Process all callbacks referring to the old manager before wiping it. + SyncWithValidationInterfaceQueue(); + LOCK(::cs_main); chainman.ResetChainstates(); BOOST_CHECK_EQUAL(chainman.GetAll().size(), 0); const ChainstateManager::Options chainman_opts{ |