aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-01-25 16:27:08 -0500
committerAva Chow <github@achow101.com>2024-06-07 12:40:21 -0400
commit27e70f1f5be1f536f2314cd2ea42b4f80d927fbd (patch)
tree0cdfa2c9d06bf39b9839de304975aba80caf3c28 /test/functional/test_framework
parent6e4d18f37f42894fe9a0d7948c1da3f061fc6b60 (diff)
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.
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-xtest/functional/test_framework/messages.py6
-rw-r--r--test/functional/test_framework/script.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 4e496a9275..db793233b8 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -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)
diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py
index ab3dc2ffb1..8489e2937d 100644
--- a/test/functional/test_framework/script.py
+++ b/test/functional/test_framework/script.py
@@ -738,7 +738,7 @@ def SegwitV0SignatureMsg(script, txTo, inIdx, hashtype, amount):
hashOutputs = uint256_from_str(hash256(serialize_outputs))
ss = bytes()
- ss += txTo.nVersion.to_bytes(4, "little", signed=True)
+ ss += txTo.nVersion.to_bytes(4, "little")
ss += ser_uint256(hashPrevouts)
ss += ser_uint256(hashSequence)
ss += txTo.vin[inIdx].prevout.serialize()
@@ -817,7 +817,7 @@ def TaprootSignatureMsg(txTo, spent_utxos, hash_type, input_index = 0, scriptpat
in_type = hash_type & SIGHASH_ANYONECANPAY
spk = spent_utxos[input_index].scriptPubKey
ss = bytes([0, hash_type]) # epoch, hash_type
- ss += txTo.nVersion.to_bytes(4, "little", signed=True)
+ ss += txTo.nVersion.to_bytes(4, "little")
ss += txTo.nLockTime.to_bytes(4, "little")
if in_type != SIGHASH_ANYONECANPAY:
ss += BIP341_sha_prevouts(txTo)