mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-03 12:11:52 +02:00
Merge bitcoin/bitcoin#29363: test: Fix CPartialMerkleTree.nTransactions signedness
facafa90f7
test: Fix CPartialMerkleTree.nTransactions signedness (MarcoFalke) Pull request description: It is unsigned in Bitcoin Core, so the tests should match it:aa9231fafe/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 ind280617bf5
. (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters) ACKs for top commit: theStack: LGTM ACKfacafa90f7
Empact: ACKfacafa90f7
Tree-SHA512: 35ac11bb5382dffe132bfae6097efc343ef6c06b1b4b1545130ca27b228ca6894679004862fee921b095172abaddbef5972c24d9bc195ce970f35643bd4a0f09
This commit is contained in:
@ -1063,7 +1063,7 @@ class CPartialMerkleTree:
|
||||
self.vBits = []
|
||||
|
||||
def deserialize(self, f):
|
||||
self.nTransactions = int.from_bytes(f.read(4), "little", signed=True)
|
||||
self.nTransactions = int.from_bytes(f.read(4), "little")
|
||||
self.vHash = deser_uint256_vector(f)
|
||||
vBytes = deser_string(f)
|
||||
self.vBits = []
|
||||
@ -1072,7 +1072,7 @@ class CPartialMerkleTree:
|
||||
|
||||
def serialize(self):
|
||||
r = b""
|
||||
r += self.nTransactions.to_bytes(4, "little", signed=True)
|
||||
r += self.nTransactions.to_bytes(4, "little")
|
||||
r += ser_uint256_vector(self.vHash)
|
||||
vBytesArray = bytearray([0x00] * ((len(self.vBits) + 7)//8))
|
||||
for i in range(len(self.vBits)):
|
||||
|
Reference in New Issue
Block a user