Fix ChainstateManager::AddChainstate() assertion crash
Check mempool exists before accessing size when prev_chainstate doesn't have initialized mempool.
This commit is contained in:
1 file changed
+1
-1
+1
-1
@@ -6248,7 +6248,7 @@ Chainstate& ChainstateManager::AddChainstate(std::unique_ptr<Chainstate> chainst
|
|||||||
|
|
||||||
// Transfer possession of the mempool to the chainstate.
|
// Transfer possession of the mempool to the chainstate.
|
||||||
// Mempool is empty at this point because we're still in IBD.
|
// Mempool is empty at this point because we're still in IBD.
|
||||||
assert(prev_chainstate.m_mempool->size() == 0);
|
assert(!prev_chainstate.m_mempool || prev_chainstate.m_mempool->size() == 0);
|
||||||
assert(!curr_chainstate.m_mempool);
|
assert(!curr_chainstate.m_mempool);
|
||||||
std::swap(curr_chainstate.m_mempool, prev_chainstate.m_mempool);
|
std::swap(curr_chainstate.m_mempool, prev_chainstate.m_mempool);
|
||||||
return curr_chainstate;
|
return curr_chainstate;
|
||||||
|
|||||||
Reference in new issue
Block a user