diff options
author | Carl Dong <contact@carldong.me> | 2020-09-16 16:18:51 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-02-18 14:43:28 -0500 |
commit | d0da7ea57ab932eca956458fb3633585ff3c0003 (patch) | |
tree | ac597a9612534151d791149a981e1cb1f2066d93 /src | |
parent | 3a205c43dc03cc833daba93087279402f640965b (diff) |
validation: Pass in chainstate to ::LoadMempool
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 7 | ||||
-rw-r--r-- | src/validation.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index eb0e66ee30..8a0820515f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4182,7 +4182,7 @@ bool static LoadBlockIndexDB(ChainstateManager& chainman, const CChainParams& ch void CChainState::LoadMempool(const ArgsManager& args) { if (args.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { - ::LoadMempool(m_mempool); + ::LoadMempool(m_mempool, ::ChainstateActive()); } m_mempool.SetIsLoaded(!ShutdownRequested()); } @@ -5012,7 +5012,7 @@ int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::D static const uint64_t MEMPOOL_DUMP_VERSION = 1; -bool LoadMempool(CTxMemPool& pool) +bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate) { const CChainParams& chainparams = Params(); int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60; @@ -5052,7 +5052,8 @@ bool LoadMempool(CTxMemPool& pool) } if (nTime > nNow - nExpiryTimeout) { LOCK(cs_main); - if (AcceptToMemoryPoolWithTime(chainparams, pool, ::ChainstateActive(), tx, nTime, false /* bypass_limits */, + assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate)); + if (AcceptToMemoryPoolWithTime(chainparams, pool, active_chainstate, tx, nTime, false /* bypass_limits */, false /* test_accept */).m_result_type == MempoolAcceptResult::ResultType::VALID) { ++count; } else { diff --git a/src/validation.h b/src/validation.h index d03c8801b6..cc59b8f706 100644 --- a/src/validation.h +++ b/src/validation.h @@ -1024,7 +1024,7 @@ CBlockFileInfo* GetBlockFileInfo(size_t n); bool DumpMempool(const CTxMemPool& pool); /** Load the mempool from disk. */ -bool LoadMempool(CTxMemPool& pool); +bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate); //! Check whether the block associated with this index entry is pruned or not. inline bool IsBlockPruned(const CBlockIndex* pblockindex) |