Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 973 Lines • ▼ Show 20 Lines | if (!CheckProofOfWork(block.GetHash(), block.nBits, config)) { | ||||
pos.ToString()); | pos.ToString()); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool ReadBlockFromDisk(CBlock &block, const CBlockIndex *pindex, | bool ReadBlockFromDisk(CBlock &block, const CBlockIndex *pindex, | ||||
const Config &config) { | const Config &config) { | ||||
if (!ReadBlockFromDisk(block, pindex->GetBlockPos(), config)) { | CDiskBlockPos blockPos; | ||||
{ | |||||
LOCK(cs_main); | |||||
blockPos = pindex->GetBlockPos(); | |||||
} | |||||
if (!ReadBlockFromDisk(block, blockPos, config)) { | |||||
return false; | return false; | ||||
} | } | ||||
if (block.GetHash() != pindex->GetBlockHash()) { | if (block.GetHash() != pindex->GetBlockHash()) { | ||||
return error("ReadBlockFromDisk(CBlock&, CBlockIndex*): GetHash() " | return error("ReadBlockFromDisk(CBlock&, CBlockIndex*): GetHash() " | ||||
"doesn't match index for %s at %s", | "doesn't match index for %s at %s", | ||||
pindex->ToString(), pindex->GetBlockPos().ToString()); | pindex->ToString(), pindex->GetBlockPos().ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,738 Lines • Show Last 20 Lines |