mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-03 00:10:52 +02:00
Merge bitcoin/bitcoin#29363: test: Fix CPartialMerkleTree.nTransactions signedness
facafa90f7a1eee452f9baf8a1b65a2edac0982b 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 in d280617bf569f84457eaea546541dc74c67cd1e4.
(Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters)
ACKs for top commit:
theStack:
LGTM ACK facafa90f7a1eee452f9baf8a1b65a2edac0982b
Empact:
ACK facafa90f7a1eee452f9baf8a1b65a2edac0982b
Tree-SHA512: 35ac11bb5382dffe132bfae6097efc343ef6c06b1b4b1545130ca27b228ca6894679004862fee921b095172abaddbef5972c24d9bc195ce970f35643bd4a0f09
This commit is contained in:
commit
6737331c4c
@ -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)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user