From b719883081471cc1c373e8b95af3c8571fe9bbab Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 12 Feb 2024 09:01:30 -0300 Subject: [PATCH] Merge bitcoin/bitcoin#29399: test: Fix utxo set hash serialisation signedness fa0ceae970242d8d6bdef150c98f04c67b06e20c 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 6ccc8fc067bf516cda7bc5d7d721945be5ac2003. (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters) ACKs for top commit: epiccurious: Tested ACK fa0ceae970242d8d6bdef150c98f04c67b06e20c. fjahr: utACK fa0ceae970242d8d6bdef150c98f04c67b06e20c Tree-SHA512: ab4405c74fb191fff8520b456d3a800cd084d616bb9ddca27d56b8e5c8969bd537490f6e204c1870dbb09a3e130b03b22a27b6644252a024059c200bbd9004e7 --- test/functional/feature_utxo_set_hash.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/functional/feature_utxo_set_hash.py b/test/functional/feature_utxo_set_hash.py index 5f36f5dc98..450e55ed34 100755 --- a/test/functional/feature_utxo_set_hash.py +++ b/test/functional/feature_utxo_set_hash.py @@ -4,8 +4,6 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test UTXO set hash value calculation in gettxoutsetinfo.""" -import struct - from test_framework.messages import ( CBlock, COutPoint, @@ -58,7 +56,7 @@ class UTXOSetHashTest(BitcoinTestFramework): continue data = COutPoint(int(tx.rehash(), 16), n).serialize() - data += struct.pack("