Skip to content

Commit 6737331

Browse files
committed
Merge bitcoin#29363: test: Fix CPartialMerkleTree.nTransactions signedness
facafa9 test: Fix CPartialMerkleTree.nTransactions signedness (MarcoFalke) Pull request description: It is unsigned in Bitcoin Core, so the tests should match it: https://github.com/bitcoin/bitcoin/blob/aa9231fafe45513134ec8953a217cda07446fae8/src/merkleblock.h#L59 Large positive values, or "negative" values, are rejected anyway, but it still seems fine to fix this. The bug was introduced when the code was written in d280617. (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters) ACKs for top commit: theStack: LGTM ACK facafa9 Empact: ACK facafa9 Tree-SHA512: 35ac11bb5382dffe132bfae6097efc343ef6c06b1b4b1545130ca27b228ca6894679004862fee921b095172abaddbef5972c24d9bc195ce970f35643bd4a0f09
2 parents 5b8990a + facafa9 commit 6737331

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/test_framework/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ def __init__(self):
10631063
self.vBits = []
10641064

10651065
def deserialize(self, f):
1066-
self.nTransactions = int.from_bytes(f.read(4), "little", signed=True)
1066+
self.nTransactions = int.from_bytes(f.read(4), "little")
10671067
self.vHash = deser_uint256_vector(f)
10681068
vBytes = deser_string(f)
10691069
self.vBits = []
@@ -1072,7 +1072,7 @@ def deserialize(self, f):
10721072

10731073
def serialize(self):
10741074
r = b""
1075-
r += self.nTransactions.to_bytes(4, "little", signed=True)
1075+
r += self.nTransactions.to_bytes(4, "little")
10761076
r += ser_uint256_vector(self.vHash)
10771077
vBytesArray = bytearray([0x00] * ((len(self.vBits) + 7)//8))
10781078
for i in range(len(self.vBits)):

0 commit comments

Comments
 (0)