Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/chainstate.h
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | if (reset_chainstate) { | ||||
chain.InitCoinsCache(1 << 20); | chain.InitCoinsCache(1 << 20); | ||||
chain.CoinsTip().SetBestBlock(gen_hash); | chain.CoinsTip().SetBestBlock(gen_hash); | ||||
chain.setBlockIndexCandidates.insert( | chain.setBlockIndexCandidates.insert( | ||||
node.chainman->m_blockman.LookupBlockIndex(gen_hash)); | node.chainman->m_blockman.LookupBlockIndex(gen_hash)); | ||||
chain.LoadChainTip(); | chain.LoadChainTip(); | ||||
node.chainman->MaybeRebalanceCaches(); | node.chainman->MaybeRebalanceCaches(); | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!node.chainman->ActiveChainstate().ActivateBestChain(::GetConfig(), | if (!node.chainman->ActiveChainstate().ActivateBestChain(state)) { | ||||
state)) { | |||||
throw std::runtime_error( | throw std::runtime_error( | ||||
strprintf("ActivateBestChain failed. (%s)", state.ToString())); | strprintf("ActivateBestChain failed. (%s)", state.ToString())); | ||||
} | } | ||||
fCheckBlockIndex = prev_check_block_index; | fCheckBlockIndex = prev_check_block_index; | ||||
Assert(0 == WITH_LOCK(node.chainman->GetMutex(), | Assert(0 == WITH_LOCK(node.chainman->GetMutex(), | ||||
return node.chainman->ActiveHeight())); | return node.chainman->ActiveHeight())); | ||||
} | } | ||||
Show All 9 Lines |