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:
Ava Chow
2024-01-25 16:27:08 -05:00
parent 6e4d18f37f
commit 27e70f1f5b
16 changed files with 47 additions and 39 deletions

View File

@@ -1410,7 +1410,7 @@ class TaprootTest(BitcoinTestFramework):
while left:
# Construct CTransaction with random nVersion, nLocktime
tx = CTransaction()
tx.nVersion = random.choice([1, 2, random.randint(-0x80000000, 0x7fffffff)])
tx.nVersion = random.choice([1, 2, random.getrandbits(32)])
min_sequence = (tx.nVersion != 1 and tx.nVersion != 0) * 0x80000000 # The minimum sequence number to disable relative locktime
if random.choice([True, False]):
tx.nLockTime = random.randrange(LOCKTIME_THRESHOLD, self.lastblocktime - 7200) # all absolute locktimes in the past