mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Consensus: Refactor: Decouple pow.o from chainparams.o
This commit is contained in:
@@ -1158,7 +1158,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
|
||||
}
|
||||
|
||||
// Check the header
|
||||
if (!CheckProofOfWork(block.GetHash(), block.nBits))
|
||||
if (!CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus()))
|
||||
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
||||
|
||||
return true;
|
||||
@@ -2462,7 +2462,7 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
|
||||
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW)
|
||||
{
|
||||
// Check proof of work matches claimed amount
|
||||
if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits))
|
||||
if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus()))
|
||||
return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),
|
||||
REJECT_INVALID, "high-hash");
|
||||
|
||||
@@ -2545,7 +2545,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
||||
int nHeight = pindexPrev->nHeight+1;
|
||||
|
||||
// Check proof of work
|
||||
if ((block.nBits != GetNextWorkRequired(pindexPrev, &block)))
|
||||
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, Params().GetConsensus()))
|
||||
return state.DoS(100, error("%s: incorrect proof of work", __func__),
|
||||
REJECT_INVALID, "bad-diffbits");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user