Skip to content

Commit 826e12b

Browse files
committed
test: call VerifyLoadedChainstate during ChainTestingSetup
for additional coverage and similarity to actual init process.
1 parent bf66e25 commit 826e12b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/util/setup_common.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
195195
true);
196196
assert(!rv.has_value());
197197

198+
auto maybe_verify_failure = VerifyLoadedChainstate(
199+
*Assert(m_node.chainman),
200+
fReindex.load(),
201+
m_args.GetBoolArg("-reindex-chainstate", false),
202+
chainparams.GetConsensus(),
203+
m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
204+
m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL),
205+
static_cast<int64_t(*)()>(GetTime));
206+
assert(!maybe_verify_failure.has_value());
207+
198208
BlockValidationState state;
199209
if (!m_node.chainman->ActiveChainstate().ActivateBestChain(state)) {
200210
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString()));

0 commit comments

Comments
 (0)