I was seeing differerent UTXO hashes from gettxoutsetinfo
on my ARM nodes than on x86 (64 bit). After the initial panic had weared off, I eventually managed to trace this to the following:
The counters for SHA256 and friends are supposed to be 64 bit. size_t
, the type currently used, is 32-bit on architectures with a 32-bit address space. So after processing 4GB of data, the counter will wrap around on 32-bit and the hashes will start to diverge compared to those computed on 64-bit architectures.
I am sure this has no effect on any other use of hashes by the project, as there is no other place where >4GB of data is hashed in one go.
N.B. as this changes the output of gettxoutsetinfo
on many platforms anyway (needs mention in release notes) I’ve taken the liberty of addressing the direct concern in #7758 as well in a second commit.
Before first commit
0// [32-bit]
1{
2 "height": 406339,
3 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
4 "transactions": 9254293,
5 "txouts": 35345291,
6 "bytes_serialized": 1214932313,
7 "hash_serialized": "992696b26016449d90736ff28d0776167014a5d916298963331eb2c9d9d36928",
8 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
9 "total_amount": 15408336.11047113
10}
11
12// [64-bit]
13{
14 "height": 406339,
15 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
16 "transactions": 9254293,
17 "txouts": 35345291,
18 "bytes_serialized": 1214932313,
19 "hash_serialized": "acaf2a5c17a8264ea7ee8aecba3dccb9efe6c8ee1861492fff5013ff4b7a14fc",
20 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
21 "total_amount": 15408336.11047113
22}
After first commit
0// [32-bit]
1{
2 "height": 406339,
3 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
4 "transactions": 9254293,
5 "txouts": 35345291,
6 "bytes_serialized": 1214932313,
7 "hash_serialized": "acaf2a5c17a8264ea7ee8aecba3dccb9efe6c8ee1861492fff5013ff4b7a14fc",
8 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
9 "total_amount": 15408336.11047113
10}
11
12[64-bit]
13// {
14 "height": 406339,
15 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
16 "transactions": 9254293,
17 "txouts": 35345291,
18 "bytes_serialized": 1214932313,
19 "hash_serialized": "acaf2a5c17a8264ea7ee8aecba3dccb9efe6c8ee1861492fff5013ff4b7a14fc",
20 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
21 "total_amount": 15408336.11047113
22}
After second commit
0// [32-bit]
1{
2 "height": 406339,
3 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
4 "transactions": 9254293,
5 "txouts": 35345291,
6 "bytes_serialized": 1214932313,
7 "hash_serialized": "1814733d4f783cccfc4e5046b69e08077af4b26dc2279825a87c7d67522112a1",
8 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
9 "total_amount": 15408336.11047113
10}
11
12// [64-bit]
13{
14 "height": 406339,
15 "bestblock": "0000000000000000030eccfc56131ea1a560e965d22957098f978cb070f6374a",
16 "transactions": 9254293,
17 "txouts": 35345291,
18 "bytes_serialized": 1214932313,
19 "hash_serialized": "1814733d4f783cccfc4e5046b69e08077af4b26dc2279825a87c7d67522112a1",
20 // ⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
21 "total_amount": 15408336.11047113
22}