Port UtxoSnapshot::DumpSnapshot to CTxDBBase iterator
DumpSnapshot reached into the LevelDB backend's internal handle via `extern leveldb::DB *txdb`, which silently broke under -chaindb=rocksdb. Switched to the backend-agnostic CTxDBBase::NewIterator() interface; the function now works against either backend. LoadSnapshot is more involved (writes directly into a fresh txleveldb/ directory) and is bundled with the eventual LevelDB retirement. Added an IsRocksDbChainBackend() helper and an explicit guard at LoadSnapshot's entry: refuse to load with a clear error message rather than silently creating a leveldb tree alongside an active rocksdb chain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,3 +62,8 @@ std::unique_ptr<CTxDBBase> MakeChainDB(const char* pszMode)
|
||||
// Unreachable — ResolveChainDbKind throws on bad input.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool IsRocksDbChainBackend()
|
||||
{
|
||||
return ResolveChainDbKind() == ChainDbKind::RocksDB;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user