Skip to content

Commit

Permalink
fix logic error with signing/checking blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
backpacker69 committed Apr 9, 2019
1 parent 775ee71 commit 0dd5a72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rpc/mining.cpp
Expand Up @@ -731,7 +731,7 @@ UniValue submitblock(const JSONRPCRequest& request)

// peercoin: sign block
// rfc6: sign proof of stake blocks only after 0.8 fork
if ((block.IsProofOfStake() || IsBTC16BIPsEnabled(block.GetBlockTime())) && !SignBlock(block, *pwallet))
if ((block.IsProofOfStake() || !IsBTC16BIPsEnabled(block.GetBlockTime())) && !SignBlock(block, *pwallet))
throw JSONRPCError(-100, "Unable to sign block, wallet locked?");

{
Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Expand Up @@ -2933,7 +2933,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
// peercoin: check block signature
// Only check block signature if check merkle root, c.f. commit 3cd01fdf
// rfc6: validate signatures of proof of stake blocks only after 0.8 fork
if (fCheckMerkleRoot && (block.IsProofOfStake() || IsBTC16BIPsEnabled(block.GetBlockTime())) && !CheckBlockSignature(block))
if (fCheckMerkleRoot && (block.IsProofOfStake() || !IsBTC16BIPsEnabled(block.GetBlockTime())) && !CheckBlockSignature(block))
return state.DoS(100, false, REJECT_INVALID, "bad-blk-sign", false, strprintf("%s : bad block signature", __func__));

return true;
Expand Down

0 comments on commit 0dd5a72

Please sign in to comment.