diff options
author | glozow <gloriajzhao@gmail.com> | 2023-01-17 11:01:13 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2023-04-17 09:53:59 +0100 |
commit | 563a2ee4f564c8ea5f8313d711b196e260568c04 (patch) | |
tree | 5e4c10d2a89e4a7254670b6565585c451c8803ab /src/validation.cpp | |
parent | c4554fe894d7af8e666f5d424deccddf516713ef (diff) |
[policy] disallow transactions under min relay fee, even in packages
Avoid adding transactions below min relay feerate because, even if they
were bumped through CPFP when entering the mempool, we do not have a
DoS-resistant way of ensuring they always remain bumped. In the future,
this rule can be relaxed (e.g. to allow packages to bump 0-fee
transactions) if we find a way to do so.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index e82fead89e..0fa7cbbabd 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -844,9 +844,18 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws) return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "bad-txns-too-many-sigops", strprintf("%d", nSigOpsCost)); - // No individual transactions are allowed below the min relay feerate and mempool min feerate except from - // disconnected blocks and transactions in a package. Package transactions will be checked using - // package feerate later. + // No individual transactions are allowed below the min relay feerate except from disconnected blocks. + // This requirement, unlike CheckFeeRate, cannot be bypassed using m_package_feerates because, + // while a tx could be package CPFP'd when entering the mempool, we do not have a DoS-resistant + // method of ensuring the tx remains bumped. For example, the fee-bumping child could disappear + // due to a replacement. + if (!bypass_limits && ws.m_modified_fees < m_pool.m_min_relay_feerate.GetFee(ws.m_vsize)) { + return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "min relay fee not met", + strprintf("%d < %d", ws.m_modified_fees, m_pool.m_min_relay_feerate.GetFee(ws.m_vsize))); + } + // No individual transactions are allowed below the mempool min feerate except from disconnected + // blocks and transactions in a package. Package transactions will be checked using package + // feerate later. if (!bypass_limits && !args.m_package_feerates && !CheckFeeRate(ws.m_vsize, ws.m_modified_fees, state)) return false; ws.m_iters_conflicting = m_pool.GetIterSet(ws.m_conflicts); |