mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
consensus: Store transaction nVersion as uint32_t
Given that the use of a transaction's nVersion is always as an unsigned int, it doesn't make sense to store it as signed and then cast it to unsigned.
This commit is contained in:
@@ -582,7 +582,7 @@ class CTransaction:
|
||||
self.wit = copy.deepcopy(tx.wit)
|
||||
|
||||
def deserialize(self, f):
|
||||
self.nVersion = int.from_bytes(f.read(4), "little", signed=True)
|
||||
self.nVersion = int.from_bytes(f.read(4), "little")
|
||||
self.vin = deser_vector(f, CTxIn)
|
||||
flags = 0
|
||||
if len(self.vin) == 0:
|
||||
@@ -605,7 +605,7 @@ class CTransaction:
|
||||
|
||||
def serialize_without_witness(self):
|
||||
r = b""
|
||||
r += self.nVersion.to_bytes(4, "little", signed=True)
|
||||
r += self.nVersion.to_bytes(4, "little")
|
||||
r += ser_vector(self.vin)
|
||||
r += ser_vector(self.vout)
|
||||
r += self.nLockTime.to_bytes(4, "little")
|
||||
@@ -617,7 +617,7 @@ class CTransaction:
|
||||
if not self.wit.is_null():
|
||||
flags |= 1
|
||||
r = b""
|
||||
r += self.nVersion.to_bytes(4, "little", signed=True)
|
||||
r += self.nVersion.to_bytes(4, "little")
|
||||
if flags:
|
||||
dummy = []
|
||||
r += ser_vector(dummy)
|
||||
|
||||
Reference in New Issue
Block a user