aboutsummaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2019-01-23 15:14:16 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2019-05-02 11:00:19 -0400
commit7b999103e21509e1c2dec10f68e48744ffe90f55 (patch)
tree4c602dc5527eec26313c0aeced76b691047abab6 /src/consensus
parentb8b4c80146780f9011abbd1be72343cc965c07b9 (diff)
downloadbitcoin-7b999103e21509e1c2dec10f68e48744ffe90f55.tar.xz
Clean up banning levels
Compared with previous bans, the following changes are made: * Txn with empty vin/vout or null prevouts move from 10 DoS points to 100. * Loose transactions with a dependency loop now result in a ban instead of 10 DoS points. * Many pre-segwit soft-fork errors now result in a ban. Note: Transactions that violate soft-fork script flags since P2SH do not generally result in a ban. Also, banning behavior for invalid blocks is dependent on whether the node is validating with multiple script check threads, due to a long- standing bug. That inconsistency is still present after this commit. * Proof of work failure moves from 50 DoS points to a ban. * Blocks with timestamps under MTP now result in a ban, blocks too far in the future continue to *not* result in a ban. * Inclusion of non-final transactions in a block now results in a ban instead of 10 DoS points. Co-authored-by: Anthony Towns <aj@erisian.com.au>
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/tx_check.cpp6
-rw-r--r--src/consensus/tx_verify.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp
index 61a607ef7f..638f6b808d 100644
--- a/src/consensus/tx_check.cpp
+++ b/src/consensus/tx_check.cpp
@@ -11,9 +11,9 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
{
// 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 limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
@@ -50,7 +50,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
{
for (const auto& txin : tx.vin)
if (txin.prevout.IsNull())
- return state.DoS(10, false, REJECT_INVALID, "bad-txns-prevout-null");
+ return state.DoS(100, false, REJECT_INVALID, "bad-txns-prevout-null");
}
return true;
diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
index fbbbcfd040..24b5338503 100644
--- a/src/consensus/tx_verify.cpp
+++ b/src/consensus/tx_verify.cpp
@@ -172,8 +172,8 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, CValidationState& state, c
// If prev is coinbase, check that it's matured
if (coin.IsCoinBase() && nSpendHeight - coin.nHeight < COINBASE_MATURITY) {
- return state.Invalid(false,
- REJECT_INVALID, "bad-txns-premature-spend-of-coinbase",
+ return state.DoS(0, false,
+ REJECT_INVALID, "bad-txns-premature-spend-of-coinbase", false,
strprintf("tried to spend coinbase at depth %d", nSpendHeight - coin.nHeight));
}