Skip to content

Commit d0da7ea

Browse files
committed
validation: Pass in chainstate to ::LoadMempool
1 parent 3a205c4 commit d0da7ea

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/validation.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,7 +4182,7 @@ bool static LoadBlockIndexDB(ChainstateManager& chainman, const CChainParams& ch
41824182
void CChainState::LoadMempool(const ArgsManager& args)
41834183
{
41844184
if (args.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
4185-
::LoadMempool(m_mempool);
4185+
::LoadMempool(m_mempool, ::ChainstateActive());
41864186
}
41874187
m_mempool.SetIsLoaded(!ShutdownRequested());
41884188
}
@@ -5012,7 +5012,7 @@ int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::D
50125012

50135013
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
50145014

5015-
bool LoadMempool(CTxMemPool& pool)
5015+
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate)
50165016
{
50175017
const CChainParams& chainparams = Params();
50185018
int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
@@ -5052,7 +5052,8 @@ bool LoadMempool(CTxMemPool& pool)
50525052
}
50535053
if (nTime > nNow - nExpiryTimeout) {
50545054
LOCK(cs_main);
5055-
if (AcceptToMemoryPoolWithTime(chainparams, pool, ::ChainstateActive(), tx, nTime, false /* bypass_limits */,
5055+
assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
5056+
if (AcceptToMemoryPoolWithTime(chainparams, pool, active_chainstate, tx, nTime, false /* bypass_limits */,
50565057
false /* test_accept */).m_result_type == MempoolAcceptResult::ResultType::VALID) {
50575058
++count;
50585059
} else {

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ CBlockFileInfo* GetBlockFileInfo(size_t n);
10241024
bool DumpMempool(const CTxMemPool& pool);
10251025

10261026
/** Load the mempool from disk. */
1027-
bool LoadMempool(CTxMemPool& pool);
1027+
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate);
10281028

10291029
//! Check whether the block associated with this index entry is pruned or not.
10301030
inline bool IsBlockPruned(const CBlockIndex* pblockindex)

0 commit comments

Comments
 (0)