@@ -968,6 +968,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
968968
969969 CAmount nValueOut = tx.GetValueOut ();
970970 CAmount nFees = nValueIn-nValueOut;
971+ // nModifiedFees includes any fee deltas from PrioritiseTransaction
972+ CAmount nModifiedFees = nFees;
973+ double nPriorityDummy = 0 ;
974+ pool.ApplyDeltas (hash, nPriorityDummy, nModifiedFees);
975+
971976 CAmount inChainInputValue;
972977 double dPriority = view.GetPriority (tx, chainActive.Height (), inChainInputValue);
973978
@@ -987,22 +992,25 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
987992
988993 // Don't accept it if it can't get into a block
989994 CAmount txMinFee = GetMinRelayFee (tx, pool, nSize, true );
995+
996+ // txMinFee takes into account priority/fee deltas, so compare using
997+ // nFees rather than nModifiedFees
990998 if (fLimitFree && nFees < txMinFee)
991999 return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " insufficient fee" , false ,
9921000 strprintf (" %d < %d" , nFees, txMinFee));
9931001
9941002 CAmount mempoolRejectFee = pool.GetMinFee (GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ).GetFee (nSize);
995- if (mempoolRejectFee > 0 && nFees < mempoolRejectFee) {
1003+ if (mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) {
9961004 return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " mempool min fee not met" , false , strprintf (" %d < %d" , nFees, mempoolRejectFee));
997- } else if (GetBoolArg (" -relaypriority" , DEFAULT_RELAYPRIORITY) && nFees < ::minRelayTxFee.GetFee (nSize) && !AllowFree (entry.GetPriority (chainActive.Height () + 1 ))) {
1005+ } else if (GetBoolArg (" -relaypriority" , DEFAULT_RELAYPRIORITY) && nModifiedFees < ::minRelayTxFee.GetFee (nSize) && !AllowFree (entry.GetPriority (chainActive.Height () + 1 ))) {
9981006 // Require that free transactions have sufficient priority to be mined in the next block.
9991007 return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " insufficient priority" );
10001008 }
10011009
10021010 // Continuously rate-limit free (really, very-low-fee) transactions
10031011 // This mitigates 'penny-flooding' -- sending thousands of free transactions just to
10041012 // be annoying or make others' transactions take longer to confirm.
1005- if (fLimitFree && nFees < ::minRelayTxFee.GetFee (nSize))
1013+ if (fLimitFree && nModifiedFees < ::minRelayTxFee.GetFee (nSize))
10061014 {
10071015 static CCriticalSection csFreeLimiter;
10081016 static double dFreeCount;
@@ -1061,10 +1069,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
10611069 uint64_t nConflictingCount = 0 ;
10621070 CTxMemPool::setEntries allConflicting;
10631071
1064- CAmount nModifiedFees = nFees;
1065- double nPriorityDummy = 0 ;
1066- pool.ApplyDeltas (hash, nPriorityDummy, nModifiedFees);
1067-
10681072 // If we don't hold the lock allConflicting might be incomplete; the
10691073 // subsequent RemoveStaged() and addUnchecked() calls don't guarantee
10701074 // mempool consistency for us.
0 commit comments