MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ReconsiderBlock

Function ReconsiderBlock

src/rpc/blockchain.cpp:1774–1792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1772}
1773
1774void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) {
1775 {
1776 LOCK(chainman.GetMutex());
1777 CBlockIndex* pblockindex = chainman.m_blockman.LookupBlockIndex(block_hash);
1778 if (!pblockindex) {
1779 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
1780 }
1781
1782 chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
1783 chainman.RecalculateBestHeader();
1784 }
1785
1786 BlockValidationState state;
1787 chainman.ActiveChainstate().ActivateBestChain(state);
1788
1789 if (!state.IsValid()) {
1790 throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString());
1791 }
1792}
1793
1794static RPCMethod reconsiderblock()
1795{

Callers 1

reconsiderblockFunction · 0.85

Calls 7

JSONRPCErrorFunction · 0.85
LookupBlockIndexMethod · 0.80
RecalculateBestHeaderMethod · 0.80
ActivateBestChainMethod · 0.80
IsValidMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected