mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-13 06:01:45 +00:00
Fix DoS vulnerability in mempool acceptance
Moves the IsStandard check to happen after the premature-witness check, so that adding a witness to a transaction can't prevent mempool acceptance. Note that this doesn't address the broader category of potential mempool DoS issues that affect transactions after segwit activation.
This commit is contained in:
parent
91abb77970
commit
bb66a11396
10
src/main.cpp
10
src/main.cpp
@ -1132,11 +1132,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
|||||||
if (tx.IsCoinBase())
|
if (tx.IsCoinBase())
|
||||||
return state.DoS(100, false, REJECT_INVALID, "coinbase");
|
return state.DoS(100, false, REJECT_INVALID, "coinbase");
|
||||||
|
|
||||||
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
|
||||||
string reason;
|
|
||||||
if (fRequireStandard && !IsStandardTx(tx, reason))
|
|
||||||
return state.DoS(0, false, REJECT_NONSTANDARD, reason);
|
|
||||||
|
|
||||||
// Don't relay version 2 transactions until CSV is active, and we can be
|
// Don't relay version 2 transactions until CSV is active, and we can be
|
||||||
// sure that such transactions will be mined (unless we're on
|
// sure that such transactions will be mined (unless we're on
|
||||||
// -testnet/-regtest).
|
// -testnet/-regtest).
|
||||||
@ -1150,6 +1145,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
|||||||
return state.DoS(0, false, REJECT_NONSTANDARD, "no-witness-yet", true);
|
return state.DoS(0, false, REJECT_NONSTANDARD, "no-witness-yet", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
||||||
|
string reason;
|
||||||
|
if (fRequireStandard && !IsStandardTx(tx, reason))
|
||||||
|
return state.DoS(0, false, REJECT_NONSTANDARD, reason);
|
||||||
|
|
||||||
// Only accept nLockTime-using transactions that can be mined in the next
|
// Only accept nLockTime-using transactions that can be mined in the next
|
||||||
// block; we don't want our mempool filled up with transactions that can't
|
// block; we don't want our mempool filled up with transactions that can't
|
||||||
// be mined yet.
|
// be mined yet.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user