assumeutxo: Add network magic ctor param to SnapshotMetadata

This prevents SnapshotMetadata from using any globals implicitly.
This commit is contained in:
Fabian Jahr
2024-05-24 11:41:42 +02:00
parent 1f1f998455
commit 6b6084850b
7 changed files with 22 additions and 12 deletions

View File

@@ -2697,7 +2697,7 @@ UniValue CreateUTXOSnapshot(
tip->nHeight, tip->GetBlockHash().ToString(),
fs::PathToString(path), fs::PathToString(temppath)));
SnapshotMetadata metadata{tip->GetBlockHash(), tip->nHeight, maybe_stats->coins_count};
SnapshotMetadata metadata{chainstate.m_chainman.GetParams().MessageStart(), tip->GetBlockHash(), tip->nHeight, maybe_stats->coins_count};
afile << metadata;
@@ -2809,7 +2809,7 @@ static RPCHelpMan loadtxoutset()
"Couldn't open file " + path.utf8string() + " for reading.");
}
SnapshotMetadata metadata;
SnapshotMetadata metadata{chainman.GetParams().MessageStart()};
try {
afile >> metadata;
} catch (const std::ios_base::failure& e) {