Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,843 Lines • ▼ Show 20 Lines | UniValue unparkblock(const Config &config, const JSONRPCRequest &request) { | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
const std::string strHash = request.params[0].get_str(); | const std::string strHash = request.params[0].get_str(); | ||||
const BlockHash hash(uint256S(strHash)); | const BlockHash hash(uint256S(strHash)); | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (mapBlockIndex.count(hash) == 0) { | |||||
CBlockIndex *pblockindex = LookupBlockIndex(hash); | |||||
if (!pblockindex) { | |||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | ||||
} | } | ||||
CBlockIndex *pblockindex = mapBlockIndex[hash]; | |||||
UnparkBlockAndChildren(pblockindex); | UnparkBlockAndChildren(pblockindex); | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
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 806 Lines • Show Last 20 Lines |