Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,589 Lines • ▼ Show 20 Lines | return RPCHelpMan{ | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
pblockindex = chainman.m_blockman.LookupBlockIndex(hash); | pblockindex = chainman.m_blockman.LookupBlockIndex(hash); | ||||
if (!pblockindex) { | if (!pblockindex) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Block not found"); | "Block not found"); | ||||
} | } | ||||
} | } | ||||
chainman.ActiveChainstate().InvalidateBlock(config, state, | chainman.ActiveChainstate().InvalidateBlock(state, pblockindex); | ||||
pblockindex); | |||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
chainman.ActiveChainstate().ActivateBestChain(state); | chainman.ActiveChainstate().ActivateBestChain(state); | ||||
} | } | ||||
if (!state.IsValid()) { | if (!state.IsValid()) { | ||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString()); | throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString()); | ||||
} | } | ||||
Show All 36 Lines | return RPCHelpMan{ | ||||
if (active_chainstate.IsBlockAvalancheFinalized(pblockindex)) { | if (active_chainstate.IsBlockAvalancheFinalized(pblockindex)) { | ||||
// Reset avalanche finalization if we park a finalized | // Reset avalanche finalization if we park a finalized | ||||
// block. | // block. | ||||
active_chainstate.ClearAvalancheFinalizedBlock(); | active_chainstate.ClearAvalancheFinalizedBlock(); | ||||
} | } | ||||
} | } | ||||
active_chainstate.ParkBlock(config, state, pblockindex); | active_chainstate.ParkBlock(state, pblockindex); | ||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
active_chainstate.ActivateBestChain(state); | active_chainstate.ActivateBestChain(state); | ||||
} | } | ||||
if (!state.IsValid()) { | if (!state.IsValid()) { | ||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); | throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,094 Lines • Show Last 20 Lines |