diff options
author | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2019-07-17 18:40:34 +0900 |
---|---|---|
committer | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2020-09-18 09:37:57 +0900 |
commit | a8de47a1c9033fac3355590f1fe2158a95011bb3 (patch) | |
tree | f75c49126205ad5223bcef9998fa41d4457b372c /src | |
parent | e8990f121405af8cd539b904ef082439261e6c93 (diff) |
consensus: add signet validation
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index be1374e810..adf9198b52 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -33,6 +33,7 @@ #include <script/script.h> #include <script/sigcache.h> #include <shutdown.h> +#include <signet.h> #include <timedata.h> #include <tinyformat.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)) 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; } @@ -3332,6 +3338,11 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW)) 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. if (fCheckMerkleRoot) { bool mutated; |