mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
validation: Pass in chainstate to ::LoadMempool
This commit is contained in:
parent
3a205c43dc
commit
d0da7ea57a
2 changed files with 5 additions and 4 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue