aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-08-11 15:51:27 +0100
committerglozow <gloriajzhao@gmail.com>2021-09-02 16:23:27 +0100
commit9c2f9f89846264b503d5573341bb78cf609cbc5e (patch)
tree80134146612422e568eb61bc4c53cbe67d187f43 /src/validation.cpp
parent3f033f01a6b0f7772ae1b21044903b8f4249ad08 (diff)
downloadbitcoin-9c2f9f89846264b503d5573341bb78cf609cbc5e.tar.xz
MOVEONLY: check that fees > direct conflicts to policy/rbf
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 710fe2d873..b0403bffd2 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -782,30 +782,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
if (fReplacementTransaction)
{
CFeeRate newFeeRate(nModifiedFees, nSize);
- for (const auto& mi : setIterConflicting) {
- // Don't allow the replacement to reduce the feerate of the
- // mempool.
- //
- // We usually don't want to accept replacements with lower
- // feerates than what they replaced as that would lower the
- // feerate of the next block. Requiring that the feerate always
- // be increased is also an easy-to-reason about way to prevent
- // DoS attacks via replacements.
- //
- // We only consider the feerates of transactions being directly
- // replaced, not their indirect descendants. While that does
- // mean high feerate children are ignored when deciding whether
- // or not to replace, we do require the replacement to pay more
- // overall fees too, mitigating most cases.
- CFeeRate oldFeeRate(mi->GetModifiedFee(), mi->GetTxSize());
- if (newFeeRate <= oldFeeRate)
- {
- return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee",
- strprintf("rejecting replacement %s; new feerate %s <= old feerate %s",
- hash.ToString(),
- newFeeRate.ToString(),
- oldFeeRate.ToString()));
- }
+ if (const auto err_string{PaysMoreThanConflicts(setIterConflicting, newFeeRate, hash)}) {
+ return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee", *err_string);
}
// Calculate all conflicting entries and enforce Rule #5.