mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
consensus: add signet validation
This commit is contained in:
parent
e8990f1214
commit
a8de47a1c9
1 changed files with 11 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include <script/script.h>
|
#include <script/script.h>
|
||||||
#include <script/sigcache.h>
|
#include <script/sigcache.h>
|
||||||
#include <shutdown.h>
|
#include <shutdown.h>
|
||||||
|
#include <signet.h>
|
||||||
#include <timedata.h>
|
#include <timedata.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <txdb.h>
|
#include <txdb.h>
|
||||||
|
@ -1163,6 +1164,11 @@ bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, const Consensus::P
|
||||||
if (!CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
|
if (!CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
|
||||||
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
||||||
|
|
||||||
|
// Signet only: check block solution
|
||||||
|
if (consensusParams.signet_blocks && !CheckSignetBlockSolution(block, consensusParams)) {
|
||||||
|
return error("ReadBlockFromDisk: Errors in block solution at %s", pos.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3332,6 +3338,11 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu
|
||||||
if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW))
|
if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Signet only: check block solution
|
||||||
|
if (consensusParams.signet_blocks && fCheckPOW && !CheckSignetBlockSolution(block, consensusParams)) {
|
||||||
|
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-signet-blksig", "signet block signature validation failure");
|
||||||
|
}
|
||||||
|
|
||||||
// Check the merkle root.
|
// Check the merkle root.
|
||||||
if (fCheckMerkleRoot) {
|
if (fCheckMerkleRoot) {
|
||||||
bool mutated;
|
bool mutated;
|
||||||
|
|
Loading…
Add table
Reference in a new issue