mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-26 12:24:40 +02:00
validation: Remove global ::{{Precious,Invalidate}Block,ResetBlockFailureFlags}
This commit is contained in:
parent
4927c9e699
commit
a3ba08ba7d
@ -1562,7 +1562,7 @@ static RPCHelpMan preciousblock()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockValidationState state;
|
BlockValidationState state;
|
||||||
PreciousBlock(state, Params(), pblockindex);
|
::ChainstateActive().PreciousBlock(state, Params(), pblockindex);
|
||||||
|
|
||||||
if (!state.IsValid()) {
|
if (!state.IsValid()) {
|
||||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString());
|
throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString());
|
||||||
@ -1598,7 +1598,7 @@ static RPCHelpMan invalidateblock()
|
|||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InvalidateBlock(state, Params(), pblockindex);
|
::ChainstateActive().InvalidateBlock(state, Params(), pblockindex);
|
||||||
|
|
||||||
if (state.IsValid()) {
|
if (state.IsValid()) {
|
||||||
::ChainstateActive().ActivateBestChain(state, Params());
|
::ChainstateActive().ActivateBestChain(state, Params());
|
||||||
@ -1637,7 +1637,7 @@ static RPCHelpMan reconsiderblock()
|
|||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetBlockFailureFlags(pblockindex);
|
::ChainstateActive().ResetBlockFailureFlags(pblockindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockValidationState state;
|
BlockValidationState state;
|
||||||
|
@ -2965,9 +2965,6 @@ bool CChainState::PreciousBlock(BlockValidationState& state, const CChainParams&
|
|||||||
|
|
||||||
return ActivateBestChain(state, params, std::shared_ptr<const CBlock>());
|
return ActivateBestChain(state, params, std::shared_ptr<const CBlock>());
|
||||||
}
|
}
|
||||||
bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlockIndex *pindex) {
|
|
||||||
return ::ChainstateActive().PreciousBlock(state, params, pindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex)
|
bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex)
|
||||||
{
|
{
|
||||||
@ -3105,10 +3102,6 @@ bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParam
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex) {
|
|
||||||
return ::ChainstateActive().InvalidateBlock(state, chainparams, pindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
|
void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
@ -3143,10 +3136,6 @@ void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetBlockFailureFlags(CBlockIndex *pindex) {
|
|
||||||
return ::ChainstateActive().ResetBlockFailureFlags(pindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
CBlockIndex* BlockManager::AddToBlockIndex(const CBlockHeader& block)
|
CBlockIndex* BlockManager::AddToBlockIndex(const CBlockHeader& block)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
@ -721,8 +721,14 @@ public:
|
|||||||
bool DisconnectTip(BlockValidationState& state, const CChainParams& chainparams, DisconnectedBlockTransactions* disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
|
bool DisconnectTip(BlockValidationState& state, const CChainParams& chainparams, DisconnectedBlockTransactions* disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
|
||||||
|
|
||||||
// Manual block validity manipulation:
|
// Manual block validity manipulation:
|
||||||
|
/** Mark a block as precious and reorganize.
|
||||||
|
*
|
||||||
|
* May not be called in a validationinterface callback.
|
||||||
|
*/
|
||||||
bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
|
bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
|
||||||
|
/** Mark a block as invalid. */
|
||||||
bool InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
|
bool InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
|
||||||
|
/** Remove invalidity status from a block and its descendants. */
|
||||||
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
|
||||||
/** Replay blocks that aren't fully applied to the database. */
|
/** Replay blocks that aren't fully applied to the database. */
|
||||||
@ -779,19 +785,6 @@ private:
|
|||||||
friend ChainstateManager;
|
friend ChainstateManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Mark a block as precious and reorganize.
|
|
||||||
*
|
|
||||||
* May not be called in a
|
|
||||||
* validationinterface callback.
|
|
||||||
*/
|
|
||||||
bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlockIndex *pindex) LOCKS_EXCLUDED(cs_main);
|
|
||||||
|
|
||||||
/** Mark a block as invalid. */
|
|
||||||
bool InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
|
|
||||||
|
|
||||||
/** Remove invalidity status from a block and its descendants. */
|
|
||||||
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface for creating and interacting with one or two
|
* Provides an interface for creating and interacting with one or two
|
||||||
* chainstates: an IBD chainstate generated by downloading blocks, and
|
* chainstates: an IBD chainstate generated by downloading blocks, and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user