@@ -255,12 +255,12 @@ bool CheckSequenceLocksAtTip(CBlockIndex* tip,
255
255
// Returns the script flags which should be checked for a given block
256
256
static unsigned int GetBlockScriptFlags (const CBlockIndex& block_index, const ChainstateManager& chainman);
257
257
258
- static void LimitMempoolSize (CTxMemPool& pool, CCoinsViewCache& coins_cache, std::chrono::seconds age )
258
+ static void LimitMempoolSize (CTxMemPool& pool, CCoinsViewCache& coins_cache)
259
259
EXCLUSIVE_LOCKS_REQUIRED(::cs_main, pool.cs)
260
260
{
261
261
AssertLockHeld (::cs_main);
262
262
AssertLockHeld (pool.cs );
263
- int expired = pool.Expire (GetTime<std::chrono::seconds>() - age );
263
+ int expired = pool.Expire (GetTime<std::chrono::seconds>() - pool. m_expiry );
264
264
if (expired != 0 ) {
265
265
LogPrint (BCLog::MEMPOOL, " Expired %i transactions from the memory pool\n " , expired);
266
266
}
@@ -374,10 +374,7 @@ void CChainState::MaybeUpdateMempoolForReorg(
374
374
// We also need to remove any now-immature transactions
375
375
m_mempool->removeForReorg (m_chain, filter_final_and_mature);
376
376
// Re-limit mempool size, in case we added any transactions
377
- LimitMempoolSize (
378
- *m_mempool,
379
- this ->CoinsTip (),
380
- std::chrono::hours{gArgs .GetIntArg (" -mempoolexpiry" , DEFAULT_MEMPOOL_EXPIRY)});
377
+ LimitMempoolSize (*m_mempool, this ->CoinsTip ());
381
378
}
382
379
383
380
/* *
@@ -1081,7 +1078,7 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws)
1081
1078
// in the package. LimitMempoolSize() should be called at the very end to make sure the mempool
1082
1079
// is still within limits and package submission happens atomically.
1083
1080
if (!args.m_package_submission && !bypass_limits) {
1084
- LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip (), std::chrono::hours{ gArgs . GetIntArg ( " -mempoolexpiry " , DEFAULT_MEMPOOL_EXPIRY)} );
1081
+ LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip ());
1085
1082
if (!m_pool.exists (GenTxid::Txid (hash)))
1086
1083
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " mempool full" );
1087
1084
}
@@ -1146,8 +1143,7 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>&
1146
1143
1147
1144
// It may or may not be the case that all the transactions made it into the mempool. Regardless,
1148
1145
// make sure we haven't exceeded max mempool size.
1149
- LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip (),
1150
- std::chrono::hours{gArgs .GetIntArg (" -mempoolexpiry" , DEFAULT_MEMPOOL_EXPIRY)});
1146
+ LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip ());
1151
1147
1152
1148
// Find the wtxids of the transactions that made it into the mempool. Allow partial submission,
1153
1149
// but don't report success unless they all made it into the mempool.
@@ -4645,7 +4641,7 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
4645
4641
4646
4642
bool LoadMempool (CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function)
4647
4643
{
4648
- int64_t nExpiryTimeout = gArgs . GetIntArg ( " -mempoolexpiry " , DEFAULT_MEMPOOL_EXPIRY) * 60 * 60 ;
4644
+ int64_t nExpiryTimeout = std::chrono::seconds{pool. m_expiry }. count () ;
4649
4645
FILE* filestr{mockable_fopen_function (gArgs .GetDataDirNet () / " mempool.dat" , " rb" )};
4650
4646
CAutoFile file (filestr, SER_DISK, CLIENT_VERSION);
4651
4647
if (file.IsNull ()) {
0 commit comments