refactor: Use type-safe assumeutxo hash

This avoids accidentally mixing it up with other hashes (like block
hashes).
This commit is contained in:
MarcoFalke
2021-04-04 14:20:13 +02:00
parent 0000007709
commit fa5668bfb3
4 changed files with 11 additions and 6 deletions

View File

@@ -10,6 +10,7 @@
#include <consensus/params.h>
#include <primitives/block.h>
#include <protocol.h>
#include <util/hash_type.h>
#include <memory>
#include <vector>
@@ -25,6 +26,10 @@ struct CCheckpointData {
}
};
struct AssumeutxoHash : public BaseHash<uint256> {
explicit AssumeutxoHash(const uint256& hash) : BaseHash(hash) {}
};
/**
* Holds configuration for use during UTXO snapshot load and validation. The contents
* here are security critical, since they dictate which UTXO snapshots are recognized
@@ -32,7 +37,7 @@ struct CCheckpointData {
*/
struct AssumeutxoData {
//! The expected hash of the deserialized UTXO set.
const uint256 hash_serialized;
const AssumeutxoHash hash_serialized;
//! Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
//!