Skip to content

Commit c464e67

Browse files
committed
Merge bitcoin/bitcoin#28050: test: make assumeUTXO test capture the expected fatal error
3e8bf2e test: make assumeUTXO test capture the expected fatal error (furszy) Pull request description: The test is exercising the error, so it can capture it before the test framework displays it on the console as an unforeseen fatal error. It is odd to observe a fatal error after executing the complete test suite and seeing it pass successfully. Reproduction Steps: Run the unit test suite. A long AssumeUTXO fatal error will be printed even when all tests pass successfully. ACKs for top commit: MarcoFalke: lgtm ACK 3e8bf2e theStack: Tested ACK 3e8bf2e TheCharlatan: ACK 3e8bf2e Tree-SHA512: 820a5a4db52085ed72cbe7eb433b8c0f2d283ac6f5d456bc2b3e3f0305301022b2729e32e5fd9002859e4491ae7ac6de568a4c20557c7b249b0e7694ab8bd177
2 parents 79e8247 + 3e8bf2e commit c464e67

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/validation_chainstatemanager_tests.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <rpc/blockchain.h>
1111
#include <sync.h>
1212
#include <test/util/chainstate.h>
13+
#include <test/util/logging.h>
1314
#include <test/util/random.h>
1415
#include <test/util/setup_common.h>
1516
#include <timedata.h>
@@ -659,8 +660,11 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_snapshot_completion_hash_mismatch, Sna
659660
fs::path snapshot_chainstate_dir = gArgs.GetDataDirNet() / "chainstate_snapshot";
660661
BOOST_CHECK(fs::exists(snapshot_chainstate_dir));
661662

662-
res = WITH_LOCK(::cs_main, return chainman.MaybeCompleteSnapshotValidation());
663-
BOOST_CHECK_EQUAL(res, SnapshotCompletionResult::HASH_MISMATCH);
663+
{
664+
ASSERT_DEBUG_LOG("failed to validate the -assumeutxo snapshot state");
665+
res = WITH_LOCK(::cs_main, return chainman.MaybeCompleteSnapshotValidation());
666+
BOOST_CHECK_EQUAL(res, SnapshotCompletionResult::HASH_MISMATCH);
667+
}
664668

665669
auto all_chainstates = chainman.GetAll();
666670
BOOST_CHECK_EQUAL(all_chainstates.size(), 1);

0 commit comments

Comments
 (0)