File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -451,11 +451,11 @@ class CRegTestParams : public CChainParams {
451451 m_assumeutxo_data = MapAssumeutxo{
452452 {
453453 110 ,
454- {uint256S (" 0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" ), 110 },
454+ {AssumeutxoHash{ uint256S (" 0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" )} , 110 },
455455 },
456456 {
457457 210 ,
458- {uint256S (" 0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" ), 210 },
458+ {AssumeutxoHash{ uint256S (" 0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" )} , 210 },
459459 },
460460 };
461461
Original file line number Diff line number Diff line change 1010#include < consensus/params.h>
1111#include < primitives/block.h>
1212#include < protocol.h>
13+ #include < util/hash_type.h>
1314
1415#include < memory>
1516#include < vector>
@@ -25,14 +26,18 @@ struct CCheckpointData {
2526 }
2627};
2728
29+ struct AssumeutxoHash : public BaseHash <uint256> {
30+ explicit AssumeutxoHash (const uint256& hash) : BaseHash(hash) {}
31+ };
32+
2833/* *
2934 * Holds configuration for use during UTXO snapshot load and validation. The contents
3035 * here are security critical, since they dictate which UTXO snapshots are recognized
3136 * as valid.
3237 */
3338struct AssumeutxoData {
3439 // ! The expected hash of the deserialized UTXO set.
35- const uint256 hash_serialized;
40+ const AssumeutxoHash hash_serialized;
3641
3742 // ! Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
3843 // !
Original file line number Diff line number Diff line change @@ -135,11 +135,11 @@ BOOST_AUTO_TEST_CASE(test_assumeutxo)
135135 }
136136
137137 const auto out110 = *ExpectedAssumeutxo (110 , *params);
138- BOOST_CHECK_EQUAL (out110.hash_serialized , uint256S ( " 1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" ) );
138+ BOOST_CHECK_EQUAL (out110.hash_serialized . ToString (), " 1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" );
139139 BOOST_CHECK_EQUAL (out110.nChainTx , (unsigned int )110 );
140140
141141 const auto out210 = *ExpectedAssumeutxo (210 , *params);
142- BOOST_CHECK_EQUAL (out210.hash_serialized , uint256S ( " 9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" ) );
142+ BOOST_CHECK_EQUAL (out210.hash_serialized . ToString (), " 9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" );
143143 BOOST_CHECK_EQUAL (out210.nChainTx , (unsigned int )210 );
144144}
145145
Original file line number Diff line number Diff line change @@ -4939,7 +4939,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
49394939
49404940 const AssumeutxoData& au_data = *maybe_au_data;
49414941
4942- if (stats.hashSerialized != au_data.hash_serialized ) {
4942+ if (AssumeutxoHash{ stats.hashSerialized } != au_data.hash_serialized ) {
49434943 LogPrintf (" [snapshot] bad snapshot content hash: expected %s, got %s\n " ,
49444944 au_data.hash_serialized .ToString (), stats.hashSerialized .ToString ());
49454945 return false ;
You can’t perform that action at this time.
0 commit comments