diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2786,8 +2786,10 @@ nodestate->m_tx_download.m_tx_in_flight.erase(txid); EraseTxRequest(txid); - if (!AlreadyHave(inv) && AcceptToMemoryPool(config, g_mempool, state, - ptx, &fMissingInputs)) { + if (!AlreadyHave(inv) && + AcceptToMemoryPool(config, g_mempool, state, ptx, &fMissingInputs, + false /* bypass_limits */, + Amount::zero() /* nAbsurdFee */)) { g_mempool.check(pcoinsTip.get()); RelayTransaction(tx, connman); for (size_t i = 0; i < tx.vout.size(); i++) { @@ -2832,7 +2834,9 @@ } if (AcceptToMemoryPool(config, g_mempool, stateDummy, - porphanTx, &fMissingInputs2)) { + porphanTx, &fMissingInputs2, + false /* bypass_limits */, + Amount::zero() /* nAbsurdFee */)) { LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanId.ToString()); RelayTransaction(orphanTx, connman); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1179,7 +1179,8 @@ CValidationState state; bool fMissingInputs; if (!AcceptToMemoryPool(config, g_mempool, state, std::move(tx), - &fMissingInputs, false, nMaxRawTxFee)) { + &fMissingInputs, false /* bypass_limits */, + nMaxRawTxFee)) { if (state.IsInvalid()) { throw JSONRPCError(RPC_TRANSACTION_REJECTED, FormatStateMessage(state)); @@ -1291,8 +1292,7 @@ LOCK(cs_main); test_accept_res = AcceptToMemoryPool( config, g_mempool, state, std::move(tx), &missing_inputs, - /* bypass_limits */ false, max_raw_tx_fee, - /* test_accept */ true); + false /* bypass_limits */, max_raw_tx_fee, true /* test_accept */); } result_0.pushKV("allowed", test_accept_res); if (!test_accept_res) { diff --git a/src/test/txvalidation_tests.cpp b/src/test/txvalidation_tests.cpp --- a/src/test/txvalidation_tests.cpp +++ b/src/test/txvalidation_tests.cpp @@ -42,7 +42,7 @@ AcceptToMemoryPool(GetConfig(), g_mempool, state, MakeTransactionRef(coinbaseTx), nullptr /* pfMissingInputs */, - true /* fOverrideMempoolLimit */, + true /* bypass_limits */, Amount::zero() /* nAbsurdFee */)); // Check that the transaction hasn't been added to mempool. diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -30,9 +30,10 @@ LOCK(cs_main); CValidationState state; - return AcceptToMemoryPool(GetConfig(), g_mempool, state, - MakeTransactionRef(tx), nullptr, true, - Amount::zero()); + return AcceptToMemoryPool( + GetConfig(), g_mempool, state, MakeTransactionRef(tx), + nullptr /* pfMissingInputs */, true /* bypass_limits */, + Amount::zero() /* nAbsurdFee */); } BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) { diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1367,8 +1367,10 @@ // ignore validation errors in resurrected transactions CValidationState stateDummy; if (!fAddToMempool || tx->IsCoinBase() || - !AcceptToMemoryPool(config, g_mempool, stateDummy, tx, nullptr, - true)) { + !AcceptToMemoryPool(config, g_mempool, stateDummy, tx, + nullptr /* pfMissingInputs */, + true /* bypass_limits */, + Amount::zero() /* nAbsurdFee */)) { // If the transaction doesn't make it in to the mempool, remove any // transactions that depend on it (which would now be orphans). g_mempool.removeRecursive(*tx, MemPoolRemovalReason::REORG); diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -449,10 +449,8 @@ */ bool AcceptToMemoryPool(const Config &config, CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, - bool *pfMissingInputs, - bool fOverrideMempoolLimit = false, - const Amount nAbsurdFee = Amount::zero(), - bool test_accept = false) + bool *pfMissingInputs, bool bypass_limits, + const Amount nAbsurdFee, bool test_accept = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Convert CValidationState to a human-readable message for logging */ diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -532,7 +532,7 @@ AcceptToMemoryPoolWorker(const Config &config, CTxMemPool &pool, CValidationState &state, const CTransactionRef &ptx, bool *pfMissingInputs, int64_t nAcceptTime, - bool fOverrideMempoolLimit, const Amount nAbsurdFee, + bool bypass_limits, const Amount nAbsurdFee, std::vector &coins_to_uncache, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { AssertLockHeld(cs_main); @@ -699,8 +699,7 @@ // No transactions are allowed below minRelayTxFee except from // disconnected blocks - if (!fOverrideMempoolLimit && - nModifiedFees < minRelayTxFee.GetFee(nSize)) { + if (!bypass_limits && nModifiedFees < minRelayTxFee.GetFee(nSize)) { return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "min relay fee not met"); } @@ -710,7 +709,7 @@ gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000) .GetFee(nSize); - if (!fOverrideMempoolLimit && mempoolRejectFee > Amount::zero() && + if (!bypass_limits && mempoolRejectFee > Amount::zero() && nModifiedFees < mempoolRejectFee) { return state.DoS( 0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", @@ -800,7 +799,7 @@ pool.addUnchecked(txid, entry, setAncestors); // Trim mempool and check if tx was trimmed. - if (!fOverrideMempoolLimit) { + if (!bypass_limits) { pool.LimitSize( gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * @@ -823,13 +822,13 @@ AcceptToMemoryPoolWithTime(const Config &config, CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool *pfMissingInputs, int64_t nAcceptTime, - bool fOverrideMempoolLimit, const Amount nAbsurdFee, + bool bypass_limits, const Amount nAbsurdFee, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { AssertLockHeld(cs_main); std::vector coins_to_uncache; bool res = AcceptToMemoryPoolWorker( - config, pool, state, tx, pfMissingInputs, nAcceptTime, - fOverrideMempoolLimit, nAbsurdFee, coins_to_uncache, test_accept); + config, pool, state, tx, pfMissingInputs, nAcceptTime, bypass_limits, + nAbsurdFee, coins_to_uncache, test_accept); if (!res) { for (const COutPoint &outpoint : coins_to_uncache) { pcoinsTip->Uncache(outpoint); @@ -846,11 +845,11 @@ bool AcceptToMemoryPool(const Config &config, CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, - bool *pfMissingInputs, bool fOverrideMempoolLimit, + bool *pfMissingInputs, bool bypass_limits, const Amount nAbsurdFee, bool test_accept) { return AcceptToMemoryPoolWithTime(config, pool, state, tx, pfMissingInputs, - GetTime(), fOverrideMempoolLimit, - nAbsurdFee, test_accept); + GetTime(), bypass_limits, nAbsurdFee, + test_accept); } /** @@ -5520,7 +5519,7 @@ LOCK(cs_main); AcceptToMemoryPoolWithTime( config, pool, state, tx, nullptr /* pfMissingInputs */, - nTime, false /* fOverrideMempoolLimit */, + nTime, false /* bypass_limits */, Amount::zero() /* nAbsurdFee */, false /* test_accept */); if (state.IsValid()) { ++count; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4810,9 +4810,9 @@ // user could call sendmoney in a loop and hit spurious out of funds errors // because we think that this newly generated transaction's change is // unavailable as we're not yet aware that it is in the mempool. - bool ret = ::AcceptToMemoryPool( - GetConfig(), g_mempool, state, tx, nullptr /* pfMissingInputs */, - false /* fOverrideMempoolLimit */, nAbsurdFee); + bool ret = ::AcceptToMemoryPool(GetConfig(), g_mempool, state, tx, + nullptr /* pfMissingInputs */, + false /* bypass_limits */, nAbsurdFee); fInMempool |= ret; return ret; }