Skip to content

Commit bb05857

Browse files
committed
refuse to activate a UTXO snapshot if mempool not empty
This ensures that we avoid any unexpected conditions inherent in transferring non-empty mempools across chainstates. Note that this should never happen in practice given that snapshot activation will not occur outside of IBD, based upon the height checks in `loadtxoutset`.
1 parent ce585a9 commit bb05857

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/validation.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5185,6 +5185,14 @@ bool ChainstateManager::ActivateSnapshot(
51855185
return false;
51865186
}
51875187

5188+
{
5189+
LOCK(::cs_main);
5190+
if (Assert(m_active_chainstate->GetMempool())->size() > 0) {
5191+
LogPrintf("[snapshot] can't activate a snapshot when mempool not empty\n");
5192+
return false;
5193+
}
5194+
}
5195+
51885196
int64_t current_coinsdb_cache_size{0};
51895197
int64_t current_coinstip_cache_size{0};
51905198

0 commit comments

Comments
 (0)