diff --git a/src/avalanche/test/peermanager_tests.cpp b/src/avalanche/test/peermanager_tests.cpp --- a/src/avalanche/test/peermanager_tests.cpp +++ b/src/avalanche/test/peermanager_tests.cpp @@ -680,8 +680,7 @@ { BlockValidationState state; chainman.ActiveChainstate().InvalidateBlock( - GetConfig(), state, - WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip())); + state, WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip())); BOOST_CHECK_EQUAL( WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight()), 99); } @@ -1134,8 +1133,7 @@ { BlockValidationState state; active_chainstate.InvalidateBlock( - GetConfig(), state, - WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip())); + state, WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip())); BOOST_CHECK_EQUAL( WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight()), 99); } diff --git a/src/avalanche/test/processor_tests.cpp b/src/avalanche/test/processor_tests.cpp --- a/src/avalanche/test/processor_tests.cpp +++ b/src/avalanche/test/processor_tests.cpp @@ -1898,10 +1898,9 @@ // Create a couple concurrent chain tips CBlockIndex *tip = provider.buildVoteItem(); - const auto &config = GetConfig(); auto &activeChainstate = m_node.chainman->ActiveChainstate(); 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 CBlock altblock = CreateAndProcessBlock({}, CScript() << OP_TRUE); diff --git a/src/bench/chained_tx.cpp b/src/bench/chained_tx.cpp --- a/src/bench/chained_tx.cpp +++ b/src/bench/chained_tx.cpp @@ -203,7 +203,7 @@ BlockValidationState state; // Disconnect blocks with long transaction chains - activeChainState.InvalidateBlock(config, state, blockToInvalidate); + activeChainState.InvalidateBlock(state, blockToInvalidate); assert(state.IsValid()); activeChainState.ActivateBestChain(state); diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -6221,8 +6221,7 @@ case avalanche::VoteStatus::Invalid: case avalanche::VoteStatus::Rejected: { BlockValidationState state; - m_chainman.ActiveChainstate().ParkBlock(config, state, - pindex); + m_chainman.ActiveChainstate().ParkBlock(state, pindex); if (!state.IsValid()) { LogPrintf("ERROR: Database error: %s\n", state.GetRejectReason()); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1595,8 +1595,7 @@ "Block not found"); } } - chainman.ActiveChainstate().InvalidateBlock(config, state, - pblockindex); + chainman.ActiveChainstate().InvalidateBlock(state, pblockindex); if (state.IsValid()) { chainman.ActiveChainstate().ActivateBestChain(state); @@ -1649,7 +1648,7 @@ } } - active_chainstate.ParkBlock(config, state, pblockindex); + active_chainstate.ParkBlock(state, pblockindex); if (state.IsValid()) { active_chainstate.ActivateBestChain(state); diff --git a/src/test/interfaces_tests.cpp b/src/test/interfaces_tests.cpp --- a/src/test/interfaces_tests.cpp +++ b/src/test/interfaces_tests.cpp @@ -123,7 +123,7 @@ auto *orig_tip = active.Tip(); for (int i = 0; i < 10; ++i) { BlockValidationState state; - m_node.chainman->ActiveChainstate().InvalidateBlock(GetConfig(), state, + m_node.chainman->ActiveChainstate().InvalidateBlock(state, active.Tip()); } BOOST_CHECK_EQUAL(active.Height(), orig_tip->nHeight - 10); diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -938,15 +938,15 @@ !cs_avalancheFinalizedBlockIndex) LOCKS_EXCLUDED(cs_main); /** Mark a block as invalid. */ - bool InvalidateBlock(const Config &config, BlockValidationState &state, - CBlockIndex *pindex) LOCKS_EXCLUDED(cs_main) - EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, - !cs_avalancheFinalizedBlockIndex); + bool InvalidateBlock(BlockValidationState &state, CBlockIndex *pindex) + LOCKS_EXCLUDED(cs_main) + EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, + !cs_avalancheFinalizedBlockIndex); /** Park a block. */ - bool ParkBlock(const Config &config, BlockValidationState &state, - CBlockIndex *pindex) LOCKS_EXCLUDED(cs_main) - EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, - !cs_avalancheFinalizedBlockIndex); + bool ParkBlock(BlockValidationState &state, CBlockIndex *pindex) + LOCKS_EXCLUDED(cs_main) + EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex, + !cs_avalancheFinalizedBlockIndex); /** * Mark a block as finalized by avalanche. @@ -1074,8 +1074,8 @@ void UnparkBlockImpl(CBlockIndex *pindex, bool fClearChildren) EXCLUSIVE_LOCKS_REQUIRED(cs_main); - bool UnwindBlock(const Config &config, BlockValidationState &state, - CBlockIndex *pindex, bool invalidate) + bool UnwindBlock(BlockValidationState &state, CBlockIndex *pindex, + bool invalidate) EXCLUSIVE_LOCKS_REQUIRED(m_chainstate_mutex, !cs_avalancheFinalizedBlockIndex); diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3300,8 +3300,8 @@ }; } // namespace -bool Chainstate::UnwindBlock(const Config &config, BlockValidationState &state, - CBlockIndex *pindex, bool invalidate) { +bool Chainstate::UnwindBlock(BlockValidationState &state, CBlockIndex *pindex, + bool invalidate) { // Genesis block can't be invalidated or parked assert(pindex); if (pindex->nHeight == 0) { @@ -3529,25 +3529,23 @@ return true; } -bool Chainstate::InvalidateBlock(const Config &config, - BlockValidationState &state, +bool Chainstate::InvalidateBlock(BlockValidationState &state, CBlockIndex *pindex) { AssertLockNotHeld(m_chainstate_mutex); AssertLockNotHeld(::cs_main); // See 'Note for backport of Core PR16849' in Chainstate::UnwindBlock LOCK(m_chainstate_mutex); - return UnwindBlock(config, state, pindex, true); + return UnwindBlock(state, pindex, true); } -bool Chainstate::ParkBlock(const Config &config, BlockValidationState &state, - CBlockIndex *pindex) { +bool Chainstate::ParkBlock(BlockValidationState &state, CBlockIndex *pindex) { AssertLockNotHeld(m_chainstate_mutex); AssertLockNotHeld(::cs_main); // See 'Note for backport of Core PR16849' in Chainstate::UnwindBlock LOCK(m_chainstate_mutex); - return UnwindBlock(config, state, pindex, false); + return UnwindBlock(state, pindex, false); } template