Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,548 Lines • ▼ Show 20 Lines | return RPCHelpMan{ | ||||
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"); | ||||
} | } | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
chainman.ActiveChainstate().PreciousBlock(config, state, | chainman.ActiveChainstate().PreciousBlock(state, pblockindex); | ||||
pblockindex); | |||||
if (!state.IsValid()) { | if (!state.IsValid()) { | ||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); | throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); | ||||
} | } | ||||
// Block to make sure wallet/indexers sync before returning | // Block to make sure wallet/indexers sync before returning | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
Show All 28 Lines | return RPCHelpMan{ | ||||
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(config, state, | ||||
pblockindex); | pblockindex); | ||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
chainman.ActiveChainstate().ActivateBestChain(config, 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()); | ||||
} | } | ||||
// Block to make sure wallet/indexers sync before returning | // Block to make sure wallet/indexers sync before returning | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
Show All 36 Lines | return RPCHelpMan{ | ||||
// block. | // block. | ||||
active_chainstate.ClearAvalancheFinalizedBlock(); | active_chainstate.ClearAvalancheFinalizedBlock(); | ||||
} | } | ||||
} | } | ||||
active_chainstate.ParkBlock(config, state, pblockindex); | active_chainstate.ParkBlock(config, state, pblockindex); | ||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
active_chainstate.ActivateBestChain(config, 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()); | ||||
} | } | ||||
// Block to make sure wallet/indexers sync before returning | // Block to make sure wallet/indexers sync before returning | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
Show All 29 Lines | return RPCHelpMan{ | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Block not found"); | "Block not found"); | ||||
} | } | ||||
chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex); | chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex); | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
chainman.ActiveChainstate().ActivateBestChain(config, 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()); | ||||
} | } | ||||
// Block to make sure wallet/indexers sync before returning | // Block to make sure wallet/indexers sync before returning | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | return RPCHelpMan{ | ||||
active_chainstate.ClearAvalancheFinalizedBlock(); | active_chainstate.ClearAvalancheFinalizedBlock(); | ||||
} | } | ||||
} | } | ||||
active_chainstate.UnparkBlockAndChildren(pblockindex); | active_chainstate.UnparkBlockAndChildren(pblockindex); | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
active_chainstate.ActivateBestChain(config, 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()); | ||||
} | } | ||||
// Block to make sure wallet/indexers sync before returning | // Block to make sure wallet/indexers sync before returning | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
▲ Show 20 Lines • Show All 980 Lines • Show Last 20 Lines |