mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Remove Chainstate::LoadMempool
The 3-line function is only called once outside of tests, so it is clearer to inline it.
This commit is contained in:
parent
b7138252ac
commit
6888886cec
4 changed files with 8 additions and 13 deletions
|
@ -115,6 +115,7 @@
|
|||
#endif
|
||||
|
||||
using kernel::DumpMempool;
|
||||
using kernel::LoadMempool;
|
||||
using kernel::ValidationCacheSizes;
|
||||
|
||||
using node::ApplyArgsManOptions;
|
||||
|
@ -1675,7 +1676,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
return;
|
||||
}
|
||||
// Load mempool from disk
|
||||
chainman.ActiveChainstate().LoadMempool(ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{});
|
||||
if (auto* pool{chainman.ActiveChainstate().GetMempool()}) {
|
||||
LoadMempool(*pool, ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{}, chainman.ActiveChainstate());
|
||||
pool->SetLoadTried(!chainman.m_interrupt);
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for genesis block to be processed
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <vector>
|
||||
|
||||
using kernel::DumpMempool;
|
||||
using kernel::LoadMempool;
|
||||
|
||||
using node::MempoolPath;
|
||||
|
||||
|
@ -47,6 +48,7 @@ FUZZ_TARGET(validation_load_mempool, .init = initialize_validation_load_mempool)
|
|||
auto fuzzed_fopen = [&](const fs::path&, const char*) {
|
||||
return fuzzed_file_provider.open();
|
||||
};
|
||||
(void)chainstate.LoadMempool(MempoolPath(g_setup->m_args), fuzzed_fopen);
|
||||
(void)LoadMempool(pool, MempoolPath(g_setup->m_args), chainstate, fuzzed_fopen);
|
||||
pool.SetLoadTried(true);
|
||||
(void)DumpMempool(pool, MempoolPath(g_setup->m_args), fuzzed_fopen, true);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
using kernel::CCoinsStats;
|
||||
using kernel::CoinStatsHashType;
|
||||
using kernel::ComputeUTXOStats;
|
||||
using kernel::LoadMempool;
|
||||
using kernel::Notifications;
|
||||
|
||||
using fsbridge::FopenFn;
|
||||
|
@ -4126,13 +4125,6 @@ void PruneBlockFilesManual(Chainstate& active_chainstate, int nManualPruneHeight
|
|||
}
|
||||
}
|
||||
|
||||
void Chainstate::LoadMempool(const fs::path& load_path, FopenFn mockable_fopen_function)
|
||||
{
|
||||
if (!m_mempool) return;
|
||||
::LoadMempool(*m_mempool, load_path, *this, mockable_fopen_function);
|
||||
m_mempool->SetLoadTried(!m_chainman.m_interrupt);
|
||||
}
|
||||
|
||||
bool Chainstate::LoadChainTip()
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
|
|
|
@ -712,9 +712,6 @@ public:
|
|||
/** Find the last common block of this chain and a locator. */
|
||||
const CBlockIndex* FindForkInGlobalIndex(const CBlockLocator& locator) const EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
/** Load the persisted mempool from disk */
|
||||
void LoadMempool(const fs::path& load_path, fsbridge::FopenFn mockable_fopen_function = fsbridge::fopen);
|
||||
|
||||
/** Update the chain tip based on database information, i.e. CoinsTip()'s best block. */
|
||||
bool LoadChainTip() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue