Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,526 Lines • ▼ Show 20 Lines | UniValue finalizeblock(const Config &config, const JSONRPCRequest &request) { | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (mapBlockIndex.count(hash) == 0) { | if (mapBlockIndex.count(hash) == 0) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | ||||
} | } | ||||
CBlockIndex *pblockindex = mapBlockIndex[hash]; | CBlockIndex *pblockindex = mapBlockIndex[hash]; | ||||
FinalizeBlock(config, state, pblockindex); | FinalizeBlockAndInvalidate(config, state, pblockindex); | ||||
} | } | ||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
ActivateBestChain(config, state); | ActivateBestChain(config, 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 302 Lines • Show Last 20 Lines |