mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
refactor: Rename CTransaction::nVersion to version
In order to ensure that the change of nVersion to a uint32_t in the previous commit has no effect, rename nVersion to version in this commit so that reviewers can easily spot if a spot was missed or if there is a check somewhere whose semantics have changed.
This commit is contained in:
@@ -1408,10 +1408,10 @@ class TaprootTest(BitcoinTestFramework):
|
||||
|
||||
left = done
|
||||
while left:
|
||||
# Construct CTransaction with random nVersion, nLocktime
|
||||
# Construct CTransaction with random version, nLocktime
|
||||
tx = CTransaction()
|
||||
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
|
||||
tx.version = random.choice([1, 2, random.getrandbits(32)])
|
||||
min_sequence = (tx.version != 1 and tx.version != 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
|
||||
else:
|
||||
@@ -1502,8 +1502,8 @@ class TaprootTest(BitcoinTestFramework):
|
||||
is_standard_tx = (
|
||||
fail_input is None # Must be valid to be standard
|
||||
and (all(utxo.spender.is_standard for utxo in input_utxos)) # All inputs must be standard
|
||||
and tx.nVersion >= 1 # The tx version must be standard
|
||||
and tx.nVersion <= 2)
|
||||
and tx.version >= 1 # The tx version must be standard
|
||||
and tx.version <= 2)
|
||||
tx.rehash()
|
||||
msg = ','.join(utxo.spender.comment + ("*" if n == fail_input else "") for n, utxo in enumerate(input_utxos))
|
||||
if is_standard_tx:
|
||||
@@ -1530,7 +1530,7 @@ class TaprootTest(BitcoinTestFramework):
|
||||
# Deterministically mine coins to OP_TRUE in block 1
|
||||
assert_equal(self.nodes[0].getblockcount(), 0)
|
||||
coinbase = CTransaction()
|
||||
coinbase.nVersion = 1
|
||||
coinbase.version = 1
|
||||
coinbase.vin = [CTxIn(COutPoint(0, 0xffffffff), CScript([OP_1, OP_1]), SEQUENCE_FINAL)]
|
||||
coinbase.vout = [CTxOut(5000000000, CScript([OP_1]))]
|
||||
coinbase.nLockTime = 0
|
||||
@@ -1622,7 +1622,7 @@ class TaprootTest(BitcoinTestFramework):
|
||||
for i, spk in enumerate(old_spks + tap_spks):
|
||||
val = 42000000 * (i + 7)
|
||||
tx = CTransaction()
|
||||
tx.nVersion = 1
|
||||
tx.version = 1
|
||||
tx.vin = [CTxIn(COutPoint(lasttxid, i & 1), CScript([]), SEQUENCE_FINAL)]
|
||||
tx.vout = [CTxOut(val, spk), CTxOut(amount - val, CScript([OP_1]))]
|
||||
if i & 1:
|
||||
@@ -1679,7 +1679,7 @@ class TaprootTest(BitcoinTestFramework):
|
||||
|
||||
# Construct a deterministic transaction spending all outputs created above.
|
||||
tx = CTransaction()
|
||||
tx.nVersion = 2
|
||||
tx.version = 2
|
||||
tx.vin = []
|
||||
inputs = []
|
||||
input_spks = [tap_spks[0], tap_spks[1], old_spks[0], tap_spks[2], tap_spks[5], old_spks[2], tap_spks[6], tap_spks[3], tap_spks[4]]
|
||||
|
||||
Reference in New Issue
Block a user