@@ -384,7 +384,9 @@ void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool f
384
384
while (it != disconnectpool.queuedTx .get <insertion_order>().rend ()) {
385
385
// ignore validation errors in resurrected transactions
386
386
CValidationState stateDummy;
387
- if (!fAddToMempool || (*it)->IsCoinBase () || !AcceptToMemoryPool (mempool, stateDummy, *it, false , nullptr , nullptr , true )) {
387
+ if (!fAddToMempool || (*it)->IsCoinBase () ||
388
+ !AcceptToMemoryPool (mempool, stateDummy, *it, nullptr /* pfMissingInputs */ ,
389
+ nullptr /* plTxnReplaced */ , true /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
388
390
// If the transaction doesn't make it in to the mempool, remove any
389
391
// transactions that depend on it (which would now be orphans).
390
392
mempool.removeRecursive (**it, MemPoolRemovalReason::REORG);
@@ -443,9 +445,9 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationSt
443
445
return CheckInputs (tx, state, view, true , flags, cacheSigStore, true , txdata);
444
446
}
445
447
446
- static bool AcceptToMemoryPoolWorker (const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx, bool fLimitFree ,
448
+ static bool AcceptToMemoryPoolWorker (const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx,
447
449
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
448
- bool fOverrideMempoolLimit , const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache)
450
+ bool bypass_limits , const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache)
449
451
{
450
452
const CTransaction& tx = *ptx;
451
453
const uint256 hash = tx.GetHash ();
@@ -618,12 +620,12 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
618
620
strprintf (" %d" , nSigOpsCost));
619
621
620
622
CAmount mempoolRejectFee = pool.GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ).GetFee (nSize);
621
- if (mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) {
623
+ if (!bypass_limits && mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) {
622
624
return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " mempool min fee not met" , false , strprintf (" %d < %d" , nFees, mempoolRejectFee));
623
625
}
624
626
625
627
// No transactions are allowed below minRelayTxFee except from disconnected blocks
626
- if (fLimitFree && nModifiedFees < ::minRelayTxFee.GetFee (nSize)) {
628
+ if (!bypass_limits && nModifiedFees < ::minRelayTxFee.GetFee (nSize)) {
627
629
return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " min relay fee not met" );
628
630
}
629
631
@@ -855,17 +857,18 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
855
857
}
856
858
pool.RemoveStaged (allConflicting, false , MemPoolRemovalReason::REPLACED);
857
859
858
- // This transaction should only count for fee estimation if it isn't a
859
- // BIP 125 replacement transaction (may not be widely supported), the
860
- // node is not behind, and the transaction is not dependent on any other
861
- // transactions in the mempool.
862
- bool validForFeeEstimation = !fReplacementTransaction && IsCurrentForFeeEstimation () && pool.HasNoInputsOf (tx);
860
+ // This transaction should only count for fee estimation if:
861
+ // - it isn't a BIP 125 replacement transaction (may not be widely supported)
862
+ // - it's not being readded during a reorg which bypasses typical mempool fee limits
863
+ // - the node is not behind
864
+ // - the transaction is not dependent on any other transactions in the mempool
865
+ bool validForFeeEstimation = !fReplacementTransaction && !bypass_limits && IsCurrentForFeeEstimation () && pool.HasNoInputsOf (tx);
863
866
864
867
// Store transaction in memory
865
868
pool.addUnchecked (hash, entry, setAncestors, validForFeeEstimation);
866
869
867
870
// trim mempool and check if tx was trimmed
868
- if (!fOverrideMempoolLimit ) {
871
+ if (!bypass_limits ) {
869
872
LimitMempoolSize (pool, gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 , gArgs .GetArg (" -mempoolexpiry" , DEFAULT_MEMPOOL_EXPIRY) * 60 * 60 );
870
873
if (!pool.exists (hash))
871
874
return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " mempool full" );
@@ -878,12 +881,12 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
878
881
}
879
882
880
883
/* * (try to) add transaction to memory pool with a specified acceptance time **/
881
- static bool AcceptToMemoryPoolWithTime (const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
884
+ static bool AcceptToMemoryPoolWithTime (const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
882
885
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
883
- bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
886
+ bool bypass_limits , const CAmount nAbsurdFee)
884
887
{
885
888
std::vector<COutPoint> coins_to_uncache;
886
- bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, fLimitFree , pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, coins_to_uncache);
889
+ bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, pfMissingInputs, nAcceptTime, plTxnReplaced, bypass_limits , nAbsurdFee, coins_to_uncache);
887
890
if (!res) {
888
891
for (const COutPoint& hashTx : coins_to_uncache)
889
892
pcoinsTip->Uncache (hashTx);
@@ -894,12 +897,12 @@ static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPo
894
897
return res;
895
898
}
896
899
897
- bool AcceptToMemoryPool (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
900
+ bool AcceptToMemoryPool (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
898
901
bool * pfMissingInputs, std::list<CTransactionRef>* plTxnReplaced,
899
- bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
902
+ bool bypass_limits , const CAmount nAbsurdFee)
900
903
{
901
904
const CChainParams& chainparams = Params ();
902
- return AcceptToMemoryPoolWithTime (chainparams, pool, state, tx, fLimitFree , pfMissingInputs, GetTime (), plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee);
905
+ return AcceptToMemoryPoolWithTime (chainparams, pool, state, tx, pfMissingInputs, GetTime (), plTxnReplaced, bypass_limits , nAbsurdFee);
903
906
}
904
907
905
908
/* * Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock */
@@ -4306,7 +4309,8 @@ bool LoadMempool(void)
4306
4309
CValidationState state;
4307
4310
if (nTime + nExpiryTimeout > nNow) {
4308
4311
LOCK (cs_main);
4309
- AcceptToMemoryPoolWithTime (chainparams, mempool, state, tx, true , nullptr , nTime, nullptr , false , 0 );
4312
+ AcceptToMemoryPoolWithTime (chainparams, mempool, state, tx, nullptr /* pfMissingInputs */ , nTime,
4313
+ nullptr /* plTxnReplaced */ , false /* bypass_limits */ , 0 /* nAbsurdFee */ );
4310
4314
if (state.IsValid ()) {
4311
4315
++count;
4312
4316
} else {
0 commit comments