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 {
451
451
m_assumeutxo_data = MapAssumeutxo{
452
452
{
453
453
110 ,
454
- {uint256S (" 0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" ), 110 },
454
+ {AssumeutxoHash{ uint256S (" 0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" )} , 110 },
455
455
},
456
456
{
457
457
210 ,
458
- {uint256S (" 0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" ), 210 },
458
+ {AssumeutxoHash{ uint256S (" 0x9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" )} , 210 },
459
459
},
460
460
};
461
461
Original file line number Diff line number Diff line change 10
10
#include < consensus/params.h>
11
11
#include < primitives/block.h>
12
12
#include < protocol.h>
13
+ #include < util/hash_type.h>
13
14
14
15
#include < memory>
15
16
#include < vector>
@@ -25,14 +26,18 @@ struct CCheckpointData {
25
26
}
26
27
};
27
28
29
+ struct AssumeutxoHash : public BaseHash <uint256> {
30
+ explicit AssumeutxoHash (const uint256& hash) : BaseHash(hash) {}
31
+ };
32
+
28
33
/* *
29
34
* Holds configuration for use during UTXO snapshot load and validation. The contents
30
35
* here are security critical, since they dictate which UTXO snapshots are recognized
31
36
* as valid.
32
37
*/
33
38
struct AssumeutxoData {
34
39
// ! The expected hash of the deserialized UTXO set.
35
- const uint256 hash_serialized;
40
+ const AssumeutxoHash hash_serialized;
36
41
37
42
// ! Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
38
43
// !
Original file line number Diff line number Diff line change @@ -135,11 +135,11 @@ BOOST_AUTO_TEST_CASE(test_assumeutxo)
135
135
}
136
136
137
137
const auto out110 = *ExpectedAssumeutxo (110 , *params);
138
- BOOST_CHECK_EQUAL (out110.hash_serialized , uint256S ( " 1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" ) );
138
+ BOOST_CHECK_EQUAL (out110.hash_serialized . ToString (), " 1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618" );
139
139
BOOST_CHECK_EQUAL (out110.nChainTx , (unsigned int )110 );
140
140
141
141
const auto out210 = *ExpectedAssumeutxo (210 , *params);
142
- BOOST_CHECK_EQUAL (out210.hash_serialized , uint256S ( " 9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" ) );
142
+ BOOST_CHECK_EQUAL (out210.hash_serialized . ToString (), " 9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2" );
143
143
BOOST_CHECK_EQUAL (out210.nChainTx , (unsigned int )210 );
144
144
}
145
145
Original file line number Diff line number Diff line change @@ -4939,7 +4939,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
4939
4939
4940
4940
const AssumeutxoData& au_data = *maybe_au_data;
4941
4941
4942
- if (stats.hashSerialized != au_data.hash_serialized ) {
4942
+ if (AssumeutxoHash{ stats.hashSerialized } != au_data.hash_serialized ) {
4943
4943
LogPrintf (" [snapshot] bad snapshot content hash: expected %s, got %s\n " ,
4944
4944
au_data.hash_serialized .ToString (), stats.hashSerialized .ToString ());
4945
4945
return false ;
You can’t perform that action at this time.
0 commit comments