mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Pass mempool pointer to UnloadBlockIndex
This commit is contained in:
parent
faec851b6e
commit
fac674db20
5 changed files with 6 additions and 6 deletions
|
@ -1566,7 +1566,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
|
||||||
chainman.m_total_coinstip_cache = nCoinCacheUsage;
|
chainman.m_total_coinstip_cache = nCoinCacheUsage;
|
||||||
chainman.m_total_coinsdb_cache = nCoinDBCache;
|
chainman.m_total_coinsdb_cache = nCoinDBCache;
|
||||||
|
|
||||||
UnloadBlockIndex();
|
UnloadBlockIndex(node.mempool);
|
||||||
|
|
||||||
// new CBlockTreeDB tries to delete the existing file, which
|
// new CBlockTreeDB tries to delete the existing file, which
|
||||||
// fails if it's still open from the previous loop. Close it first:
|
// fails if it's still open from the previous loop. Close it first:
|
||||||
|
|
|
@ -83,7 +83,7 @@ void AppTests::appTests()
|
||||||
// Reset global state to avoid interfering with later tests.
|
// Reset global state to avoid interfering with later tests.
|
||||||
LogInstance().DisconnectTestLogger();
|
LogInstance().DisconnectTestLogger();
|
||||||
AbortShutdown();
|
AbortShutdown();
|
||||||
UnloadBlockIndex();
|
UnloadBlockIndex(/* mempool */ nullptr);
|
||||||
WITH_LOCK(::cs_main, g_chainman.Reset());
|
WITH_LOCK(::cs_main, g_chainman.Reset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,9 +182,9 @@ TestingSetup::~TestingSetup()
|
||||||
m_node.connman.reset();
|
m_node.connman.reset();
|
||||||
m_node.banman.reset();
|
m_node.banman.reset();
|
||||||
m_node.args = nullptr;
|
m_node.args = nullptr;
|
||||||
|
UnloadBlockIndex(m_node.mempool);
|
||||||
m_node.mempool = nullptr;
|
m_node.mempool = nullptr;
|
||||||
m_node.scheduler.reset();
|
m_node.scheduler.reset();
|
||||||
UnloadBlockIndex();
|
|
||||||
m_node.chainman->Reset();
|
m_node.chainman->Reset();
|
||||||
m_node.chainman = nullptr;
|
m_node.chainman = nullptr;
|
||||||
pblocktree.reset();
|
pblocktree.reset();
|
||||||
|
|
|
@ -4587,13 +4587,13 @@ void CChainState::UnloadBlockIndex() {
|
||||||
// May NOT be used after any connections are up as much
|
// May NOT be used after any connections are up as much
|
||||||
// of the peer-processing logic assumes a consistent
|
// of the peer-processing logic assumes a consistent
|
||||||
// block index state
|
// block index state
|
||||||
void UnloadBlockIndex()
|
void UnloadBlockIndex(CTxMemPool* mempool)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
g_chainman.Unload();
|
g_chainman.Unload();
|
||||||
pindexBestInvalid = nullptr;
|
pindexBestInvalid = nullptr;
|
||||||
pindexBestHeader = nullptr;
|
pindexBestHeader = nullptr;
|
||||||
mempool.clear();
|
if (mempool) mempool->clear();
|
||||||
vinfoBlockFile.clear();
|
vinfoBlockFile.clear();
|
||||||
nLastBlockFile = 0;
|
nLastBlockFile = 0;
|
||||||
setDirtyBlockIndex.clear();
|
setDirtyBlockIndex.clear();
|
||||||
|
|
|
@ -160,7 +160,7 @@ void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
|
||||||
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
|
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
|
||||||
bool LoadGenesisBlock(const CChainParams& chainparams);
|
bool LoadGenesisBlock(const CChainParams& chainparams);
|
||||||
/** Unload database information */
|
/** Unload database information */
|
||||||
void UnloadBlockIndex();
|
void UnloadBlockIndex(CTxMemPool* mempool);
|
||||||
/** Run an instance of the script checking thread */
|
/** Run an instance of the script checking thread */
|
||||||
void ThreadScriptCheck(int worker_num);
|
void ThreadScriptCheck(int worker_num);
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue