aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2023-09-08 06:29:32 -0400
committerJames O'Beirne <james.obeirne@pm.me>2023-09-30 06:41:23 -0400
commitbb0585779472962f40d9cdd9c6532132850d371c (patch)
treef25ec36530ce8942f98ef49db9c70359d31df343 /src/validation.cpp
parentce585a9a158476b0ad3296477b922e79f308e795 (diff)
downloadbitcoin-bb0585779472962f40d9cdd9c6532132850d371c.tar.xz
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`.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 82aafd97f8..30b3dde74f 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5185,6 +5185,14 @@ bool ChainstateManager::ActivateSnapshot(
return false;
}
+ {
+ LOCK(::cs_main);
+ if (Assert(m_active_chainstate->GetMempool())->size() > 0) {
+ LogPrintf("[snapshot] can't activate a snapshot when mempool not empty\n");
+ return false;
+ }
+ }
+
int64_t current_coinsdb_cache_size{0};
int64_t current_coinstip_cache_size{0};