diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp --- a/src/consensus/tx_check.cpp +++ b/src/consensus/tx_check.cpp @@ -14,11 +14,11 @@ CValidationState &state) { // Basic checks that don't depend on any context if (tx.vin.empty()) { - return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty"); + return state.DoS(100, false, REJECT_INVALID, "bad-txns-vin-empty"); } if (tx.vout.empty()) { - return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty"); + return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-empty"); } // Size limit @@ -81,7 +81,7 @@ std::unordered_set vInOutPoints; for (const auto &txin : tx.vin) { if (txin.prevout.IsNull()) { - return state.DoS(10, false, REJECT_INVALID, + return state.DoS(100, false, REJECT_INVALID, "bad-txns-prevout-null"); } diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -44,7 +44,7 @@ if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { // While this is only one transaction, we use txns in the error to // ensure continuity with other clients. - return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, + return state.DoS(100, false, REJECT_INVALID, "bad-txns-nonfinal", false, "non-final transaction"); } @@ -172,10 +172,10 @@ // If prev is coinbase, check that it's matured if (coin.IsCoinBase() && nSpendHeight - coin.GetHeight() < COINBASE_MATURITY) { - return state.Invalid( - false, REJECT_INVALID, "bad-txns-premature-spend-of-coinbase", - strprintf("tried to spend coinbase at depth %d", - nSpendHeight - coin.GetHeight())); + return state.DoS(0, false, REJECT_INVALID, + "bad-txns-premature-spend-of-coinbase", false, + strprintf("tried to spend coinbase at depth %d", + nSpendHeight - coin.GetHeight())); } // Check for negative or overflow input values diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3388,7 +3388,7 @@ // Check proof of work matches claimed amount if (validationOptions.shouldValidatePoW() && !CheckProofOfWork(block.GetHash(), block.nBits, params)) { - return state.DoS(50, false, REJECT_INVALID, "high-hash", false, + return state.DoS(100, false, REJECT_INVALID, "high-hash", false, "proof of work failed"); } @@ -3536,8 +3536,8 @@ // Check timestamp against prev if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) { - return state.Invalid(false, REJECT_INVALID, "time-too-old", - "block's timestamp is too early"); + return state.DoS(100, false, REJECT_INVALID, "time-too-old", + "block's timestamp is too early"); } // Check timestamp @@ -3552,9 +3552,9 @@ if ((block.nVersion < 2 && nHeight >= consensusParams.BIP34Height) || (block.nVersion < 3 && nHeight >= consensusParams.BIP66Height) || (block.nVersion < 4 && nHeight >= consensusParams.BIP65Height)) { - return state.Invalid( - false, REJECT_OBSOLETE, - strprintf("bad-version(0x%08x)", block.nVersion), + return state.DoS( + 100, false, REJECT_OBSOLETE, + strprintf("bad-version(0x%08x)", block.nVersion), false, strprintf("rejected nVersion=0x%08x block", block.nVersion)); } diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py --- a/test/functional/data/invalid_txs.py +++ b/test/functional/data/invalid_txs.py @@ -64,7 +64,7 @@ class OutputMissing(BadTxTemplate): reject_reason = "bad-txns-vout-empty" - expect_disconnect = False + expect_disconnect = True def get_tx(self): tx = CTransaction() @@ -75,7 +75,7 @@ class InputMissing(BadTxTemplate): reject_reason = "bad-txns-vin-empty" - expect_disconnect = False + expect_disconnect = True def get_tx(self): tx = CTransaction() diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -492,7 +492,8 @@ [b47], False, force_send=True, - reject_reason='high-hash') + reject_reason='high-hash', + reconnect=True) self.log.info("Reject a block with a timestamp >2 hours in the future") self.move_tip(44) @@ -550,8 +551,12 @@ b54 = self.next_block(54, spend=out[15]) b54.nTime = b35.nTime - 1 b54.solve() - self.send_blocks([b54], False, force_send=True, - reject_reason='time-too-old') + self.send_blocks( + [b54], + False, + force_send=True, + reject_reason='time-too-old', + reconnect=True) # valid timestamp self.move_tip(53) @@ -713,8 +718,11 @@ assert tx.vin[0].nSequence < 0xffffffff tx.calc_sha256() b62 = self.update_block(62, [tx]) - self.send_blocks([b62], success=False, - reject_reason='bad-txns-nonfinal') + self.send_blocks( + [b62], + success=False, + reject_reason='bad-txns-nonfinal', + reconnect=True) # Test a non-final coinbase is also rejected # @@ -729,8 +737,11 @@ b63.vtx[0].vin[0].nSequence = 0xDEADBEEF b63.vtx[0].rehash() b63 = self.update_block(63, []) - self.send_blocks([b63], success=False, - reject_reason='bad-txns-nonfinal') + self.send_blocks( + [b63], + success=False, + reject_reason='bad-txns-nonfinal', + reconnect=True) # This checks that a block with a bloated VARINT between the block_header and the array of tx such that # the block is > LEGACY_MAX_BLOCK_SIZE with the bloated varint, but <= LEGACY_MAX_BLOCK_SIZE without the bloated varint, @@ -1089,7 +1100,8 @@ [b_v1], success=False, force_send=True, - reject_reason='bad-version(0x00000001)') + reject_reason='bad-version(0x00000001)', + reconnect=True) self.move_tip(chain1_tip + 2) b_cb34 = self.next_block('b_cb34', version=4)