mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin/bitcoin#29399: test: Fix utxo set hash serialisation signedness
fa0ceae970
test: Fix utxo set hash serialisation signedness (MarcoFalke) Pull request description: It is unsigned in Bitcoin Core, so the tests should match it:5b8990a1f3/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 in6ccc8fc067
. (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters) ACKs for top commit: epiccurious: Tested ACKfa0ceae970
. fjahr: utACKfa0ceae970
Tree-SHA512: ab4405c74fb191fff8520b456d3a800cd084d616bb9ddca27d56b8e5c8969bd537490f6e204c1870dbb09a3e130b03b22a27b6644252a024059c200bbd9004e7
This commit is contained in:
commit
7d837b569d
1 changed files with 1 additions and 3 deletions
|
@ -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("<i", height * 2 + coinbase)
|
||||
data += (height * 2 + coinbase).to_bytes(4, "little")
|
||||
data += tx_out.serialize()
|
||||
|
||||
muhash.insert(data)
|
||||
|
|
Loading…
Add table
Reference in a new issue