@@ -797,32 +797,13 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
797797 }
798798
799799 // Check if it's economically rational to mine this transaction rather
800- // than the ones it replaces.
800+ // than the ones it replaces. Enforce Rules #3 and #4.
801801 for (CTxMemPool::txiter it : allConflicting) {
802802 nConflictingFees += it->GetModifiedFee ();
803803 nConflictingSize += it->GetTxSize ();
804804 }
805-
806- // The replacement must pay greater fees than the transactions it
807- // replaces - if we did the bandwidth used by those conflicting
808- // transactions would not be paid for.
809- if (nModifiedFees < nConflictingFees)
810- {
811- return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " insufficient fee" ,
812- strprintf (" rejecting replacement %s, less fees than conflicting txs; %s < %s" ,
813- hash.ToString (), FormatMoney (nModifiedFees), FormatMoney (nConflictingFees)));
814- }
815-
816- // Finally in addition to paying more fees than the conflicts the
817- // new transaction must pay for its own bandwidth.
818- CAmount nDeltaFees = nModifiedFees - nConflictingFees;
819- if (nDeltaFees < ::incrementalRelayFee.GetFee (nSize))
820- {
821- return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " insufficient fee" ,
822- strprintf (" rejecting replacement %s, not enough additional fees to relay; %s < %s" ,
823- hash.ToString (),
824- FormatMoney (nDeltaFees),
825- FormatMoney (::incrementalRelayFee.GetFee (nSize))));
805+ if (!PaysForRBF (nConflictingFees, nModifiedFees, nSize, hash, err_string)) {
806+ return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " insufficient fee" , err_string);
826807 }
827808 }
828809 return true ;
0 commit comments