Skip to content

Commit 31c6309

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25596: scripted-diff: [test] Rename BIP125_SEQUENCE_NUMBER to MAX_BIP125_RBF_SEQUENCE
faace13 test: Remove duplicate MAX_BIP125_RBF_SEQUENCE constant (MacroFake) fa0404d scripted-diff: [test] Rename BIP125_SEQUENCE_NUMBER to MAX_BIP125_RBF_SEQUENCE (MacroFake) Pull request description: Not sure why the python constant is named differently than the constant in the C++ source code. Especially, if we use this in context of MAX+1 (bitcoin/bitcoin#25575 (comment)) the rename makes sense, in my eyes. ACKs for top commit: theStack: Code-review ACK faace13 glozow: concept ACK faace13 Tree-SHA512: 1dc8cd0f067717f6ace8121b660e99f2d0f8c485c0d61b80413e07e7830e7dfaf9ce2c922c63ba2c6b42e805d59d88cd0d9c80a4b4a2fca47e77a3aba6cd4ec6
2 parents c30b3e9 + faace13 commit 31c6309

File tree

9 files changed

+23
-23
lines changed

9 files changed

+23
-23
lines changed

test/functional/feature_rbf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from decimal import Decimal
88

99
from test_framework.messages import (
10-
BIP125_SEQUENCE_NUMBER,
10+
MAX_BIP125_RBF_SEQUENCE,
1111
COIN,
1212
SEQUENCE_FINAL,
1313
)
@@ -428,7 +428,7 @@ def test_too_many_replacements_with_default_mempool_params(self):
428428

429429
optin_parent_tx = wallet.send_self_transfer_multi(
430430
from_node=normal_node,
431-
sequence=BIP125_SEQUENCE_NUMBER,
431+
sequence=MAX_BIP125_RBF_SEQUENCE,
432432
utxos_to_spend=[root_utxos[graph_num]],
433433
num_outputs=txs_per_graph,
434434
)
@@ -636,14 +636,14 @@ def test_no_inherited_signaling(self):
636636
optin_parent_tx = self.wallet.send_self_transfer(
637637
from_node=self.nodes[0],
638638
utxo_to_spend=confirmed_utxo,
639-
sequence=BIP125_SEQUENCE_NUMBER,
639+
sequence=MAX_BIP125_RBF_SEQUENCE,
640640
fee_rate=Decimal('0.01'),
641641
)
642642
assert_equal(True, self.nodes[0].getmempoolentry(optin_parent_tx['txid'])['bip125-replaceable'])
643643

644644
replacement_parent_tx = self.wallet.create_self_transfer(
645645
utxo_to_spend=confirmed_utxo,
646-
sequence=BIP125_SEQUENCE_NUMBER,
646+
sequence=MAX_BIP125_RBF_SEQUENCE,
647647
fee_rate=Decimal('0.02'),
648648
)
649649

@@ -711,7 +711,7 @@ def test_fullrbf(self):
711711
optout_tx = self.wallet.send_self_transfer(
712712
from_node=self.nodes[0],
713713
utxo_to_spend=confirmed_utxo,
714-
sequence=BIP125_SEQUENCE_NUMBER + 1,
714+
sequence=MAX_BIP125_RBF_SEQUENCE + 1,
715715
fee_rate=Decimal('0.01'),
716716
)
717717
assert_equal(False, self.nodes[0].getmempoolentry(optout_tx['txid'])['bip125-replaceable'])

test/functional/mempool_accept.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.key import ECKey
1313
from test_framework.messages import (
14-
BIP125_SEQUENCE_NUMBER,
14+
MAX_BIP125_RBF_SEQUENCE,
1515
COIN,
1616
COutPoint,
1717
CTxIn,
@@ -87,7 +87,7 @@ def run_test(self):
8787
self.log.info('A transaction not in the mempool')
8888
fee = Decimal('0.000007')
8989
utxo_to_spend = self.wallet.get_utxo(txid=txid_in_block) # use 0.3 BTC UTXO
90-
tx = self.wallet.create_self_transfer(utxo_to_spend=utxo_to_spend, sequence=BIP125_SEQUENCE_NUMBER)['tx']
90+
tx = self.wallet.create_self_transfer(utxo_to_spend=utxo_to_spend, sequence=MAX_BIP125_RBF_SEQUENCE)['tx']
9191
tx.vout[0].nValue = int((Decimal('0.3') - fee) * COIN)
9292
raw_tx_0 = tx.serialize().hex()
9393
txid_0 = tx.rehash()
@@ -125,7 +125,7 @@ def run_test(self):
125125
self.log.info('A transaction that replaces a mempool transaction')
126126
tx = tx_from_hex(raw_tx_0)
127127
tx.vout[0].nValue -= int(fee * COIN) # Double the fee
128-
tx.vin[0].nSequence = BIP125_SEQUENCE_NUMBER + 1 # Now, opt out of RBF
128+
tx.vin[0].nSequence = MAX_BIP125_RBF_SEQUENCE + 1 # Now, opt out of RBF
129129
raw_tx_0 = tx.serialize().hex()
130130
txid_0 = tx.rehash()
131131
self.check_mempool_result(

test/functional/p2p_segwit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
from test_framework.key import ECKey
1818
from test_framework.messages import (
19-
BIP125_SEQUENCE_NUMBER,
19+
MAX_BIP125_RBF_SEQUENCE,
2020
CBlockHeader,
2121
CInv,
2222
COutPoint,
@@ -589,7 +589,7 @@ def test_standardness_v0(self):
589589
tx.vin = [CTxIn(COutPoint(p2sh_tx.sha256, 0), CScript([witness_script]))]
590590
tx.vout = [CTxOut(p2sh_tx.vout[0].nValue - 10000, script_pubkey)]
591591
tx.vout.append(CTxOut(8000, script_pubkey)) # Might burn this later
592-
tx.vin[0].nSequence = BIP125_SEQUENCE_NUMBER # Just to have the option to bump this tx from the mempool
592+
tx.vin[0].nSequence = MAX_BIP125_RBF_SEQUENCE # Just to have the option to bump this tx from the mempool
593593
tx.rehash()
594594

595595
# This is always accepted, since the mempool policy is to consider segwit as always active

test/functional/rpc_packages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.messages import (
13-
BIP125_SEQUENCE_NUMBER,
13+
MAX_BIP125_RBF_SEQUENCE,
1414
COIN,
1515
CTxInWitness,
1616
tx_from_hex,
@@ -273,7 +273,7 @@ def test_conflicting(self):
273273
def test_rbf(self):
274274
node = self.nodes[0]
275275
coin = self.coins.pop()
276-
inputs = [{"txid": coin["txid"], "vout": 0, "sequence": BIP125_SEQUENCE_NUMBER}]
276+
inputs = [{"txid": coin["txid"], "vout": 0, "sequence": MAX_BIP125_RBF_SEQUENCE}]
277277
fee = Decimal('0.00125000')
278278
output = {node.get_deterministic_priv_key().address: 50 - fee}
279279
raw_replaceable_tx = node.createrawtransaction(inputs, output)

test/functional/rpc_psbt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
from test_framework.descriptors import descsum_create
1212
from test_framework.key import ECKey, H_POINT
1313
from test_framework.messages import (
14-
ser_compact_size,
14+
MAX_BIP125_RBF_SEQUENCE,
1515
WITNESS_SCALE_FACTOR,
16+
ser_compact_size,
1617
)
1718
from test_framework.test_framework import BitcoinTestFramework
1819
from test_framework.util import (
@@ -27,7 +28,6 @@
2728
import json
2829
import os
2930

30-
MAX_BIP125_RBF_SEQUENCE = 0xfffffffd
3131

3232
# Create one-input, one-output, no-fee transaction:
3333
class PSBTTest(BitcoinTestFramework):

test/functional/rpc_rawtransaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from test_framework.blocktools import COINBASE_MATURITY
1919
from test_framework.messages import (
20-
BIP125_SEQUENCE_NUMBER,
20+
MAX_BIP125_RBF_SEQUENCE,
2121
CTransaction,
2222
tx_from_hex,
2323
)
@@ -223,7 +223,7 @@ def createrawtransaction_tests(self):
223223

224224
# Test `createrawtransaction` mismatch between sequence number(s) and `replaceable` option
225225
assert_raises_rpc_error(-8, "Invalid parameter combination: Sequence number(s) contradict replaceable option",
226-
self.nodes[0].createrawtransaction, [{'txid': TXID, 'vout': 0, 'sequence': BIP125_SEQUENCE_NUMBER+1}], {}, 0, True)
226+
self.nodes[0].createrawtransaction, [{'txid': TXID, 'vout': 0, 'sequence': MAX_BIP125_RBF_SEQUENCE+1}], {}, 0, True)
227227

228228
# Test `createrawtransaction` invalid `locktime`
229229
assert_raises_rpc_error(-3, "Expected type number", self.nodes[0].createrawtransaction, [], {}, 'foo')

test/functional/test_framework/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
COIN = 100000000 # 1 btc in satoshis
4040
MAX_MONEY = 21000000 * COIN
4141

42-
BIP125_SEQUENCE_NUMBER = 0xfffffffd # Sequence number that is rbf-opt-in (BIP 125) and csv-opt-out (BIP 68)
42+
MAX_BIP125_RBF_SEQUENCE = 0xfffffffd # Sequence number that is rbf-opt-in (BIP 125) and csv-opt-out (BIP 68)
4343
SEQUENCE_FINAL = 0xffffffff # Sequence number that disables nLockTime if set for every input of a tx
4444

4545
MAX_PROTOCOL_MESSAGE_LENGTH = 4000000 # Maximum length of incoming protocol messages

test/functional/wallet_bumpfee.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
send_to_witness,
2424
)
2525
from test_framework.messages import (
26-
BIP125_SEQUENCE_NUMBER,
26+
MAX_BIP125_RBF_SEQUENCE,
2727
)
2828
from test_framework.test_framework import BitcoinTestFramework
2929
from test_framework.util import (
@@ -212,7 +212,7 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
212212
rbfraw = rbf_node.createrawtransaction([{
213213
'txid': segwitid,
214214
'vout': 0,
215-
"sequence": BIP125_SEQUENCE_NUMBER
215+
"sequence": MAX_BIP125_RBF_SEQUENCE
216216
}], {dest_address: Decimal("0.0005"),
217217
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
218218
rbfsigned = rbf_node.signrawtransactionwithwallet(rbfraw)
@@ -243,7 +243,7 @@ def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
243243
"txid": utxo["txid"],
244244
"vout": utxo["vout"],
245245
"address": utxo["address"],
246-
"sequence": BIP125_SEQUENCE_NUMBER
246+
"sequence": MAX_BIP125_RBF_SEQUENCE
247247
} for utxo in utxos]
248248
output_val = sum(utxo["amount"] for utxo in utxos) - fee
249249
rawtx = rbf_node.createrawtransaction(inputs, {dest_address: output_val})
@@ -578,7 +578,7 @@ def get_change_address(tx):
578578

579579
def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
580580
tx_input = dict(
581-
sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000")))
581+
sequence=MAX_BIP125_RBF_SEQUENCE, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000")))
582582
destinations = {dest_address: Decimal("0.00050000")}
583583
if change_size > 0:
584584
destinations[node.getrawchangeaddress()] = change_size

test/functional/wallet_listsinceblock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from test_framework.blocktools import COINBASE_MATURITY
99
from test_framework.key import ECKey
1010
from test_framework.test_framework import BitcoinTestFramework
11-
from test_framework.messages import BIP125_SEQUENCE_NUMBER
11+
from test_framework.messages import MAX_BIP125_RBF_SEQUENCE
1212
from test_framework.util import (
1313
assert_array_result,
1414
assert_equal,
@@ -346,7 +346,7 @@ def double_spends_filtered(self):
346346
dest_address = spending_node.getnewaddress()
347347

348348
tx_input = dict(
349-
sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in spending_node.listunspent()))
349+
sequence=MAX_BIP125_RBF_SEQUENCE, **next(u for u in spending_node.listunspent()))
350350
rawtx = spending_node.createrawtransaction(
351351
[tx_input], {dest_address: tx_input["amount"] - Decimal("0.00051000"),
352352
spending_node.getrawchangeaddress(): Decimal("0.00050000")})

0 commit comments

Comments
 (0)