mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Expose signed blocks in validation.cpp
This commit is contained in:
parent
cd4e553914
commit
0e473228e0
2 changed files with 6 additions and 6 deletions
|
|
@ -277,7 +277,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
|
|||
pindexNew->nTx = diskindex.nTx;
|
||||
|
||||
const uint256 block_hash = pindexNew->GetBlockHash();
|
||||
if (!CheckProofOfWork(block_hash, pindexNew->nBits, consensusParams) &&
|
||||
if (!CheckProof(pindexNew->GetBlockHeader(), consensusParams) &&
|
||||
block_hash != consensusParams.hashGenesisBlock) {
|
||||
return error("%s: CheckProofOfWork: %s, %s", __func__, block_hash.ToString(), pindexNew->ToString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus:
|
|||
|
||||
// Check the header
|
||||
const uint256 block_hash = block.GetHash();
|
||||
if (!CheckProofOfWork(block_hash, block.nBits, consensusParams) &&
|
||||
if (!CheckProof(block, consensusParams) &&
|
||||
block_hash != consensusParams.hashGenesisBlock) {
|
||||
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
||||
}
|
||||
|
|
@ -3106,8 +3106,8 @@ static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state,
|
|||
{
|
||||
// Check proof of work matches claimed amount
|
||||
if (fCheckPOW && block.GetHash() != consensusParams.hashGenesisBlock
|
||||
&& !CheckProofOfWork(block.GetHash(), block.nBits, consensusParams)) {
|
||||
return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed");
|
||||
&& !CheckProof(block, consensusParams)) {
|
||||
return state.DoS(50, false, REJECT_INVALID, g_signed_blocks ? "block-proof-invalid" : "high-hash", false, "proof of work failed");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3257,9 +3257,9 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationSta
|
|||
assert(pindexPrev != nullptr);
|
||||
const int nHeight = pindexPrev->nHeight + 1;
|
||||
|
||||
// Check proof of work
|
||||
// Check proof of work if necessary
|
||||
const Consensus::Params& consensusParams = params.GetConsensus();
|
||||
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
|
||||
if (!CheckChallenge(block, *pindexPrev, consensusParams))
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work");
|
||||
|
||||
// Check against checkpoints
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue