mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
refactor: Delete ChainstateManager::SnapshotBlockhash() method
SnapshotBlockhash() is only called two places outside of tests, and is used redundantly in some tests, checking the same field as other checks. Simplify by dropping the method and using the m_from_snapshot_blockhash field directly.
This commit is contained in:
@@ -110,7 +110,7 @@ void utxo_snapshot_fuzz(FuzzBufferType buffer)
|
||||
|
||||
const auto snapshot_path = gArgs.GetDataDirNet() / "fuzzed_snapshot.dat";
|
||||
|
||||
Assert(!chainman.SnapshotBlockhash());
|
||||
Assert(!chainman.ActiveChainstate().m_from_snapshot_blockhash);
|
||||
|
||||
{
|
||||
AutoFile outfile{fsbridge::fopen(snapshot_path, "wb")};
|
||||
@@ -183,8 +183,6 @@ void utxo_snapshot_fuzz(FuzzBufferType buffer)
|
||||
if (ActivateFuzzedSnapshot()) {
|
||||
LOCK(::cs_main);
|
||||
Assert(!chainman.ActiveChainstate().m_from_snapshot_blockhash->IsNull());
|
||||
Assert(*chainman.ActiveChainstate().m_from_snapshot_blockhash ==
|
||||
*chainman.SnapshotBlockhash());
|
||||
const auto& coinscache{chainman.ActiveChainstate().CoinsTip()};
|
||||
for (const auto& block : *g_chain) {
|
||||
Assert(coinscache.HaveCoin(COutPoint{block->vtx.at(0)->GetHash(), 0}));
|
||||
@@ -202,7 +200,6 @@ void utxo_snapshot_fuzz(FuzzBufferType buffer)
|
||||
Assert(g_chain->size() == coinscache.GetCacheSize());
|
||||
dirty_chainman = true;
|
||||
} else {
|
||||
Assert(!chainman.SnapshotBlockhash());
|
||||
Assert(!chainman.ActiveChainstate().m_from_snapshot_blockhash);
|
||||
}
|
||||
// Snapshot should refuse to load a second time regardless of validity
|
||||
|
||||
Reference in New Issue
Block a user