Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 467 Lines • ▼ Show 20 Lines | if (!request.params[0].isNull()) { | ||||
} | } | ||||
CBlock block; | CBlock block; | ||||
if (!DecodeHexBlk(block, dataval.get_str())) { | if (!DecodeHexBlk(block, dataval.get_str())) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | ||||
"Block decode failed"); | "Block decode failed"); | ||||
} | } | ||||
uint256 hash = block.GetHash(); | const BlockHash hash = block.GetHash(); | ||||
const CBlockIndex *pindex = LookupBlockIndex(hash); | const CBlockIndex *pindex = LookupBlockIndex(hash); | ||||
if (pindex) { | if (pindex) { | ||||
if (pindex->IsValid(BlockValidity::SCRIPTS)) { | if (pindex->IsValid(BlockValidity::SCRIPTS)) { | ||||
return "duplicate"; | return "duplicate"; | ||||
} | } | ||||
if (pindex->nStatus.isInvalid()) { | if (pindex->nStatus.isInvalid()) { | ||||
return "duplicate-invalid"; | return "duplicate-invalid"; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | if (!DecodeHexBlk(block, request.params[0].get_str())) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed"); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed"); | ||||
} | } | ||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) { | if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, | ||||
"Block does not start with a coinbase"); | "Block does not start with a coinbase"); | ||||
} | } | ||||
uint256 hash = block.GetHash(); | const BlockHash hash = block.GetHash(); | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
const CBlockIndex *pindex = LookupBlockIndex(hash); | const CBlockIndex *pindex = LookupBlockIndex(hash); | ||||
if (pindex) { | if (pindex) { | ||||
if (pindex->IsValid(BlockValidity::SCRIPTS)) { | if (pindex->IsValid(BlockValidity::SCRIPTS)) { | ||||
return "duplicate"; | return "duplicate"; | ||||
} | } | ||||
if (pindex->nStatus.isInvalid()) { | if (pindex->nStatus.isInvalid()) { | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |