Skip to content

Commit a8de47a

Browse files
committed
consensus: add signet validation
1 parent e8990f1 commit a8de47a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/validation.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <script/script.h>
3434
#include <script/sigcache.h>
3535
#include <shutdown.h>
36+
#include <signet.h>
3637
#include <timedata.h>
3738
#include <tinyformat.h>
3839
#include <txdb.h>
@@ -1163,6 +1164,11 @@ bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, const Consensus::P
11631164
if (!CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
11641165
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
11651166

1167+
// Signet only: check block solution
1168+
if (consensusParams.signet_blocks && !CheckSignetBlockSolution(block, consensusParams)) {
1169+
return error("ReadBlockFromDisk: Errors in block solution at %s", pos.ToString());
1170+
}
1171+
11661172
return true;
11671173
}
11681174

@@ -3332,6 +3338,11 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu
33323338
if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW))
33333339
return false;
33343340

3341+
// Signet only: check block solution
3342+
if (consensusParams.signet_blocks && fCheckPOW && !CheckSignetBlockSolution(block, consensusParams)) {
3343+
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-signet-blksig", "signet block signature validation failure");
3344+
}
3345+
33353346
// Check the merkle root.
33363347
if (fCheckMerkleRoot) {
33373348
bool mutated;

0 commit comments

Comments
 (0)