Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | if (request.params.size() > 0) { | ||||
uint256 hash = block.GetHash(); | uint256 hash = block.GetHash(); | ||||
BlockMap::iterator mi = mapBlockIndex.find(hash); | BlockMap::iterator mi = mapBlockIndex.find(hash); | ||||
if (mi != mapBlockIndex.end()) { | if (mi != mapBlockIndex.end()) { | ||||
CBlockIndex *pindex = mi->second; | CBlockIndex *pindex = mi->second; | ||||
if (pindex->IsValid(BlockValidity::SCRIPTS)) { | if (pindex->IsValid(BlockValidity::SCRIPTS)) { | ||||
return "duplicate"; | return "duplicate"; | ||||
} | } | ||||
if (pindex->nStatus & BLOCK_FAILED_MASK) { | if (pindex->nStatus.isInvalid()) { | ||||
return "duplicate-invalid"; | return "duplicate-invalid"; | ||||
} | } | ||||
return "duplicate-inconclusive"; | return "duplicate-inconclusive"; | ||||
} | } | ||||
CBlockIndex *const pindexPrev = chainActive.Tip(); | CBlockIndex *const pindexPrev = chainActive.Tip(); | ||||
// TestBlockValidity only supports blocks built on the current Tip | // TestBlockValidity only supports blocks built on the current Tip | ||||
if (block.hashPrevBlock != pindexPrev->GetBlockHash()) { | if (block.hashPrevBlock != pindexPrev->GetBlockHash()) { | ||||
▲ Show 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | static UniValue submitblock(const Config &config, | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
BlockMap::iterator mi = mapBlockIndex.find(hash); | BlockMap::iterator mi = mapBlockIndex.find(hash); | ||||
if (mi != mapBlockIndex.end()) { | if (mi != mapBlockIndex.end()) { | ||||
CBlockIndex *pindex = mi->second; | CBlockIndex *pindex = mi->second; | ||||
if (pindex->IsValid(BlockValidity::SCRIPTS)) { | if (pindex->IsValid(BlockValidity::SCRIPTS)) { | ||||
return "duplicate"; | return "duplicate"; | ||||
} | } | ||||
if (pindex->nStatus & BLOCK_FAILED_MASK) { | if (pindex->nStatus.isInvalid()) { | ||||
return "duplicate-invalid"; | return "duplicate-invalid"; | ||||
} | } | ||||
// Otherwise, we might only have the header - process the block | // Otherwise, we might only have the header - process the block | ||||
// before returning | // before returning | ||||
fBlockPresent = true; | fBlockPresent = true; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |