Skip to content

Commit

Permalink
Merge bitcoin#23736: test: call VerifyLoadedChainstate during ChainTe…
Browse files Browse the repository at this point in the history
…stingSetup

826e12b test: call VerifyLoadedChainstate during ChainTestingSetup (James O'Beirne)

Pull request description:

  for additional coverage and similarity to actual init process.

  Followup to bitcoin#23280.

ACKs for top commit:
  dongcarl:
    Code Review ACK 826e12b
  ryanofsky:
    Code review ACK 826e12b

Tree-SHA512: a4e7fd25e5d7a08b1e154ae6daf67c3048260a2684b0e569b544dd826693b7b969db9923b191e499cb8d8d0a2a73eb9330ff45909313145a9abb6052eb8c3ad9
  • Loading branch information
fanquake authored and jagdeep sidhu committed Dec 23, 2021
1 parent b960097 commit 99d9e47
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
m_cache_sizes.evo_db);
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()));
Expand Down

0 comments on commit 99d9e47

Please sign in to comment.