mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-17 12:21:17 +02:00
validation: Pass in chainstate to ::LoadMempool
This commit is contained in:
parent
3a205c43dc
commit
d0da7ea57a
@ -4182,7 +4182,7 @@ bool static LoadBlockIndexDB(ChainstateManager& chainman, const CChainParams& ch
|
|||||||
void CChainState::LoadMempool(const ArgsManager& args)
|
void CChainState::LoadMempool(const ArgsManager& args)
|
||||||
{
|
{
|
||||||
if (args.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
if (args.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
||||||
::LoadMempool(m_mempool);
|
::LoadMempool(m_mempool, ::ChainstateActive());
|
||||||
}
|
}
|
||||||
m_mempool.SetIsLoaded(!ShutdownRequested());
|
m_mempool.SetIsLoaded(!ShutdownRequested());
|
||||||
}
|
}
|
||||||
@ -5012,7 +5012,7 @@ int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::D
|
|||||||
|
|
||||||
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
|
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
|
||||||
|
|
||||||
bool LoadMempool(CTxMemPool& pool)
|
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate)
|
||||||
{
|
{
|
||||||
const CChainParams& chainparams = Params();
|
const CChainParams& chainparams = Params();
|
||||||
int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
|
int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
|
||||||
@ -5052,7 +5052,8 @@ bool LoadMempool(CTxMemPool& pool)
|
|||||||
}
|
}
|
||||||
if (nTime > nNow - nExpiryTimeout) {
|
if (nTime > nNow - nExpiryTimeout) {
|
||||||
LOCK(cs_main);
|
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) {
|
false /* test_accept */).m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
||||||
++count;
|
++count;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1024,7 +1024,7 @@ CBlockFileInfo* GetBlockFileInfo(size_t n);
|
|||||||
bool DumpMempool(const CTxMemPool& pool);
|
bool DumpMempool(const CTxMemPool& pool);
|
||||||
|
|
||||||
/** Load the mempool from disk. */
|
/** 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.
|
//! Check whether the block associated with this index entry is pruned or not.
|
||||||
inline bool IsBlockPruned(const CBlockIndex* pblockindex)
|
inline bool IsBlockPruned(const CBlockIndex* pblockindex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user