pos/pow concurrent

This commit is contained in:
2024-12-04 22:14:27 -08:00
parent a17870e6f0
commit 1fa535669d
11 changed files with 10346 additions and 153 deletions
+16
View File
@@ -4088,6 +4088,22 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
return state.Invalid(error("CheckBlock() : block timestamp too far in the future"),
REJECT_INVALID, "time-too-new");
// Add concurrent PoW and PoS validation logic
if (block.IsProofOfWork() || block.IsProofOfStake()) {
// Allow PoS starting at block 2
if (block.IsProofOfStake() && block.GetBlockHeight() < 2)
return state.DoS(100, error("CheckBlock() : PoS not allowed before block 2"),
REJECT_INVALID, "bad-pos-before-2");
// Ensure the block is valid as PoW or PoS
if (!block.IsProofOfWork() && !block.IsProofOfStake())
return state.DoS(100, error("CheckBlock() : Invalid block type, not PoW or PoS"),
REJECT_INVALID, "bad-block-type");
} else {
return state.DoS(100, error("CheckBlock() : Block must be PoW or PoS"),
REJECT_INVALID, "bad-block-type");
}
// Check the merkle root.
if (fCheckMerkleRoot) {
bool mutated;