aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-12-23 11:47:31 +0800
committerfanquake <fanquake@gmail.com>2021-12-23 12:10:16 +0800
commitf5c678e5c3f013520078768027cc8ff860a15279 (patch)
tree0db633aab5f47ccb62d89f622dd53034212d3f95 /src/test
parent63b5dfac21613b984803347bfe81454da667016e (diff)
parent826e12b010eda4238f9e8cd875e8915a405bed0d (diff)
Merge bitcoin/bitcoin#23736: test: call VerifyLoadedChainstate during ChainTestingSetup
826e12b010eda4238f9e8cd875e8915a405bed0d test: call VerifyLoadedChainstate during ChainTestingSetup (James O'Beirne) Pull request description: for additional coverage and similarity to actual init process. Followup to #23280. ACKs for top commit: dongcarl: Code Review ACK 826e12b010eda4238f9e8cd875e8915a405bed0d ryanofsky: Code review ACK 826e12b010eda4238f9e8cd875e8915a405bed0d Tree-SHA512: a4e7fd25e5d7a08b1e154ae6daf67c3048260a2684b0e569b544dd826693b7b969db9923b191e499cb8d8d0a2a73eb9330ff45909313145a9abb6052eb8c3ad9
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util/setup_common.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index d0be9fe73a..eb23e8725f 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -195,6 +195,16 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
true);
assert(!rv.has_value());
+ auto maybe_verify_failure = VerifyLoadedChainstate(
+ *Assert(m_node.chainman),
+ fReindex.load(),
+ m_args.GetBoolArg("-reindex-chainstate", false),
+ chainparams.GetConsensus(),
+ m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
+ m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL),
+ static_cast<int64_t(*)()>(GetTime));
+ assert(!maybe_verify_failure.has_value());
+
BlockValidationState state;
if (!m_node.chainman->ActiveChainstate().ActivateBestChain(state)) {
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString()));