Changeset View
Changeset View
Standalone View
Standalone View
src/test/interfaces_tests.cpp
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
BOOST_AUTO_TEST_CASE(findCommonAncestor) { | BOOST_AUTO_TEST_CASE(findCommonAncestor) { | ||||
auto &chain = m_node.chain; | auto &chain = m_node.chain; | ||||
const CChain &active{ | const CChain &active{ | ||||
*WITH_LOCK(Assert(m_node.chainman)->GetMutex(), | *WITH_LOCK(Assert(m_node.chainman)->GetMutex(), | ||||
return &Assert(m_node.chainman)->ActiveChain())}; | return &Assert(m_node.chainman)->ActiveChain())}; | ||||
auto *orig_tip = active.Tip(); | auto *orig_tip = active.Tip(); | ||||
for (int i = 0; i < 10; ++i) { | for (int i = 0; i < 10; ++i) { | ||||
BlockValidationState state; | BlockValidationState state; | ||||
m_node.chainman->ActiveChainstate().InvalidateBlock(GetConfig(), state, | m_node.chainman->ActiveChainstate().InvalidateBlock(state, | ||||
active.Tip()); | active.Tip()); | ||||
} | } | ||||
BOOST_CHECK_EQUAL(active.Height(), orig_tip->nHeight - 10); | BOOST_CHECK_EQUAL(active.Height(), orig_tip->nHeight - 10); | ||||
coinbaseKey.MakeNewKey(true); | coinbaseKey.MakeNewKey(true); | ||||
for (int i = 0; i < 20; ++i) { | for (int i = 0; i < 20; ++i) { | ||||
CreateAndProcessBlock({}, | CreateAndProcessBlock({}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |