Skip to content

Commit 7d837b5

Browse files
committed
Merge bitcoin/bitcoin#29399: test: Fix utxo set hash serialisation signedness
fa0ceae test: Fix utxo set hash serialisation signedness (MarcoFalke) Pull request description: It is unsigned in Bitcoin Core, so the tests should match it: https://github.com/bitcoin/bitcoin/blob/5b8990a1f3c49b0b02b7383c69e95320acbda13e/src/kernel/coinstats.cpp#L54 Large positive values for the block height are too difficult to hit in tests, but it still seems fine to fix this. The bug was introduced when the code was written in 6ccc8fc. (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters) ACKs for top commit: epiccurious: Tested ACK fa0ceae. fjahr: utACK fa0ceae Tree-SHA512: ab4405c74fb191fff8520b456d3a800cd084d616bb9ddca27d56b8e5c8969bd537490f6e204c1870dbb09a3e130b03b22a27b6644252a024059c200bbd9004e7
2 parents 6868474 + fa0ceae commit 7d837b5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/functional/feature_utxo_set_hash.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test UTXO set hash value calculation in gettxoutsetinfo."""
66

7-
import struct
8-
97
from test_framework.messages import (
108
CBlock,
119
COutPoint,
@@ -58,7 +56,7 @@ def test_muhash_implementation(self):
5856
continue
5957

6058
data = COutPoint(int(tx.rehash(), 16), n).serialize()
61-
data += struct.pack("<i", height * 2 + coinbase)
59+
data += (height * 2 + coinbase).to_bytes(4, "little")
6260
data += tx_out.serialize()
6361

6462
muhash.insert(data)

0 commit comments

Comments
 (0)