Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/processor_tests.cpp
Show First 20 Lines • Show All 1,892 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(block_vote_finalization_tip) { | ||||
// Adding ancestor blocks to reconcile will fail | // Adding ancestor blocks to reconcile will fail | ||||
for (size_t i = 0; i < AVALANCHE_MAX_ELEMENT_POLL - 10 - 1; i++) { | for (size_t i = 0; i < AVALANCHE_MAX_ELEMENT_POLL - 10 - 1; i++) { | ||||
BOOST_CHECK(!addToReconcile(blockIndexes[i])); | BOOST_CHECK(!addToReconcile(blockIndexes[i])); | ||||
} | } | ||||
// Create a couple concurrent chain tips | // Create a couple concurrent chain tips | ||||
CBlockIndex *tip = provider.buildVoteItem(); | CBlockIndex *tip = provider.buildVoteItem(); | ||||
const auto &config = GetConfig(); | |||||
auto &activeChainstate = m_node.chainman->ActiveChainstate(); | auto &activeChainstate = m_node.chainman->ActiveChainstate(); | ||||
BlockValidationState state; | BlockValidationState state; | ||||
activeChainstate.InvalidateBlock(config, state, tip); | activeChainstate.InvalidateBlock(state, tip); | ||||
// Use another script to make sure we don't generate the same block again | // Use another script to make sure we don't generate the same block again | ||||
CBlock altblock = CreateAndProcessBlock({}, CScript() << OP_TRUE); | CBlock altblock = CreateAndProcessBlock({}, CScript() << OP_TRUE); | ||||
auto alttip = WITH_LOCK( | auto alttip = WITH_LOCK( | ||||
cs_main, return Assert(m_node.chainman) | cs_main, return Assert(m_node.chainman) | ||||
->m_blockman.LookupBlockIndex(altblock.GetHash())); | ->m_blockman.LookupBlockIndex(altblock.GetHash())); | ||||
BOOST_CHECK(alttip); | BOOST_CHECK(alttip); | ||||
BOOST_CHECK(alttip->pprev == tip->pprev); | BOOST_CHECK(alttip->pprev == tip->pprev); | ||||
▲ Show 20 Lines • Show All 629 Lines • Show Last 20 Lines |