diff options
-rw-r--r-- | src/chainparams.cpp | 4 | ||||
-rw-r--r-- | src/chainparams.h | 7 | ||||
-rw-r--r-- | src/test/validation_tests.cpp | 4 | ||||
-rw-r--r-- | src/validation.cpp | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 8535e1cdd9..fc5a9d84cc 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -451,11 +451,11 @@ public: m_assumeutxo_data = MapAssumeutxo{ { 110, - {uint256S("0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618"), 110}, + {AssumeutxoHash{uint256S("0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618")}, 110}, }, { 210, - {uint256S("0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2"), 210}, + {AssumeutxoHash{uint256S("0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2")}, 210}, }, }; diff --git a/src/chainparams.h b/src/chainparams.h index ae0b0f3c21..5c2351eea6 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -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(). //! diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp index d0317aca0a..1e5baec01a 100644 --- a/src/test/validation_tests.cpp +++ b/src/test/validation_tests.cpp @@ -135,11 +135,11 @@ BOOST_AUTO_TEST_CASE(test_assumeutxo) } const auto out110 = *ExpectedAssumeutxo(110, *params); - BOOST_CHECK_EQUAL(out110.hash_serialized, uint256S("1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618")); + BOOST_CHECK_EQUAL(out110.hash_serialized.ToString(), "1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618"); BOOST_CHECK_EQUAL(out110.nChainTx, (unsigned int)110); const auto out210 = *ExpectedAssumeutxo(210, *params); - BOOST_CHECK_EQUAL(out210.hash_serialized, uint256S("9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2")); + BOOST_CHECK_EQUAL(out210.hash_serialized.ToString(), "9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2"); BOOST_CHECK_EQUAL(out210.nChainTx, (unsigned int)210); } diff --git a/src/validation.cpp b/src/validation.cpp index 639c1f6879..354ff182e2 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4939,7 +4939,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot( const AssumeutxoData& au_data = *maybe_au_data; - if (stats.hashSerialized != au_data.hash_serialized) { + if (AssumeutxoHash{stats.hashSerialized} != au_data.hash_serialized) { LogPrintf("[snapshot] bad snapshot content hash: expected %s, got %s\n", au_data.hash_serialized.ToString(), stats.hashSerialized.ToString()); return false; |