validation: Check if mempool exists before asserting in ActivateSnapshot

This commit is contained in:
TheCharlatan 2024-07-03 22:34:01 +02:00
parent 3714692644
commit 33c48c106c
No known key found for this signature in database
GPG key ID: 9B79B45691DB4173

View file

@ -5681,7 +5681,8 @@ util::Result<void> ChainstateManager::ActivateSnapshot(
return util::Error{strprintf(_("The base block header (%s) is part of an invalid chain."), base_blockhash.ToString())};
}
if (Assert(m_active_chainstate->GetMempool())->size() > 0) {
auto mempool{m_active_chainstate->GetMempool()};
if (mempool && mempool->size() > 0) {
return util::Error{_("Can't activate a snapshot when mempool not empty.")};
}
}