Skip to content

Commit 7821889

Browse files
committed
Consensus: Remove calls to error() from ContextualCheckBlock
1 parent 6f4092d commit 7821889

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,11 +3576,11 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
35763576
// already does not permit it, it is impossible to trigger in the
35773577
// witness tree.
35783578
if (block.vtx[0].wit.vtxinwit.size() != 1 || block.vtx[0].wit.vtxinwit[0].scriptWitness.stack.size() != 1 || block.vtx[0].wit.vtxinwit[0].scriptWitness.stack[0].size() != 32) {
3579-
return state.DoS(100, error("%s : invalid witness nonce size", __func__), REJECT_INVALID, "bad-witness-nonce-size", true);
3579+
return state.DoS(100, false, REJECT_INVALID, "bad-witness-nonce-size", true, strprintf("%s : invalid witness nonce size", __func__));
35803580
}
35813581
CHash256().Write(hashWitness.begin(), 32).Write(&block.vtx[0].wit.vtxinwit[0].scriptWitness.stack[0][0], 32).Finalize(hashWitness.begin());
35823582
if (memcmp(hashWitness.begin(), &block.vtx[0].vout[commitpos].scriptPubKey[6], 32)) {
3583-
return state.DoS(100, error("%s : witness merkle commitment mismatch", __func__), REJECT_INVALID, "bad-witness-merkle-match", true);
3583+
return state.DoS(100, false, REJECT_INVALID, "bad-witness-merkle-match", true, strprintf("%s : witness merkle commitment mismatch", __func__));
35843584
}
35853585
fHaveWitness = true;
35863586
}
@@ -3590,7 +3590,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
35903590
if (!fHaveWitness) {
35913591
for (size_t i = 0; i < block.vtx.size(); i++) {
35923592
if (!block.vtx[i].wit.IsNull()) {
3593-
return state.DoS(100, error("%s : unexpected witness data found", __func__), REJECT_INVALID, "unexpected-witness", true);
3593+
return state.DoS(100, false, REJECT_INVALID, "unexpected-witness", true, strprintf("%s : unexpected witness data found", __func__));
35943594
}
35953595
}
35963596
}
@@ -3602,7 +3602,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
36023602
// the block hash, so we couldn't mark the block as permanently
36033603
// failed).
36043604
if (GetBlockWeight(block) > MAX_BLOCK_WEIGHT) {
3605-
return state.DoS(100, error("ContextualCheckBlock(): weight limit failed"), REJECT_INVALID, "bad-blk-weight");
3605+
return state.DoS(100, false, REJECT_INVALID, "bad-blk-weight", false, strprintf("%s : weight limit failed", __func__));
36063606
}
36073607

36083608
return true;

0 commit comments

Comments
 (0)