From 6f0751b8c9a0d5652b29988318f090112d1a30aa Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 27 Feb 2024 17:46:52 +0000 Subject: [PATCH] make transactions BIP-125 replace-by-fee by default --- mmgen/data/version | 2 +- mmgen/main_split.py | 3 ++- mmgen/main_txcreate.py | 3 ++- mmgen/main_txdo.py | 3 ++- mmgen/proto/btc/tx/new.py | 3 ++- test/cmdtest_py_d/ct_main.py | 2 +- test/cmdtest_py_d/ct_regtest.py | 4 ++-- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mmgen/data/version b/mmgen/data/version index d3fa14c5..c8d8f2a7 100644 --- a/mmgen/data/version +++ b/mmgen/data/version @@ -1 +1 @@ -14.1.dev13 +14.1.dev14 diff --git a/mmgen/main_split.py b/mmgen/main_split.py index cc3caad2..7c6a1418 100755 --- a/mmgen/main_split.py +++ b/mmgen/main_split.py @@ -43,7 +43,8 @@ opts_data = { -m, --minconf= n Minimum number of confirmations required to spend outputs (default: 1) -q, --quiet Suppress warnings; overwrite files without prompting --r, --rbf Make transaction BIP 125 replaceable (replace-by-fee) +-R, --no-rbf Make transaction non-replaceable (non-replace-by-fee + according to BIP 125) -v, --verbose Produce more verbose output -y, --yes Answer 'yes' to prompts, suppress non-essential output -R, --rpc-host2= h Host the other coin daemon is running on (default: none) diff --git a/mmgen/main_txcreate.py b/mmgen/main_txcreate.py index e8480b10..771e4908 100755 --- a/mmgen/main_txcreate.py +++ b/mmgen/main_txcreate.py @@ -55,7 +55,8 @@ opts_data = { -m, --minconf= n Minimum number of confirmations required to spend outputs (default: 1) -q, --quiet Suppress warnings; overwrite files without prompting --r, --rbf Make transaction BIP 125 replaceable (replace-by-fee) +-R, --no-rbf Make transaction non-replaceable (non-replace-by-fee + according to BIP 125) -v, --verbose Produce more verbose output -V, --vsize-adj= f Adjust transaction's estimated vsize by factor 'f' -y, --yes Answer 'yes' to prompts, suppress non-essential output diff --git a/mmgen/main_txdo.py b/mmgen/main_txdo.py index 15b4490d..2816a226 100755 --- a/mmgen/main_txdo.py +++ b/mmgen/main_txdo.py @@ -75,7 +75,8 @@ opts_data = { -p, --hash-preset= p Use the scrypt hash parameters defined by preset 'p' for password hashing (default: '{gc.dfl_hash_preset}') -P, --passwd-file= f Get {pnm} wallet passphrase from file 'f' --r, --rbf Make transaction BIP 125 (replace-by-fee) replaceable +-R, --no-rbf Make transaction non-replaceable (non-replace-by-fee + according to BIP 125) -q, --quiet Suppress warnings; overwrite files without prompting -u, --subseeds= n The number of subseed pairs to scan for (default: {ss}, maximum: {ss_max}). Only the default or first supplied diff --git a/mmgen/proto/btc/tx/new.py b/mmgen/proto/btc/tx/new.py index 16249b8f..494dd655 100755 --- a/mmgen/proto/btc/tx/new.py +++ b/mmgen/proto/btc/tx/new.py @@ -113,7 +113,8 @@ class New(Base,TxBase.New): if not bump: self.inputs.sort_bip69() # Set all sequence numbers to the same value, in conformity with the behavior of most modern wallets: - seqnum_val = self.proto.max_int - (2 if self.cfg.rbf else 1 if locktime else 0) + do_rbf = self.proto.cap('rbf') and not self.cfg.no_rbf + seqnum_val = self.proto.max_int - (2 if do_rbf else 1 if locktime else 0) for i in self.inputs: i.sequence = seqnum_val diff --git a/test/cmdtest_py_d/ct_main.py b/test/cmdtest_py_d/ct_main.py index ea1be861..2b737dab 100755 --- a/test/cmdtest_py_d/ct_main.py +++ b/test/cmdtest_py_d/ct_main.py @@ -629,7 +629,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared): t = self.spawn( 'mmgen-'+('txcreate','txdo')[bool(txdo_args)], - ([],['--rbf'])[self.proto.cap('rbf')] + + (['--no-rbf'],[])[self.proto.cap('rbf')] + ['-f',self.tx_fee,'-B'] + add_args + cmd_args + txdo_args) if t.expect([('Get','Unsigned transac')[cmdline_inputs],r'Unable to connect to \S+'],regex=True) == 1: diff --git a/test/cmdtest_py_d/ct_regtest.py b/test/cmdtest_py_d/ct_regtest.py index a76db1d4..a2b6acb0 100755 --- a/test/cmdtest_py_d/ct_regtest.py +++ b/test/cmdtest_py_d/ct_regtest.py @@ -986,7 +986,7 @@ class CmdTestRegtest(CmdTestBase,CmdTestShared): if not self.test_rbf: return 'skip' out_addr = self._create_tx_outputs('alice',(('B',5,''),)) - t = self.spawn('mmgen-txcreate',['-d',self.tr.trash_dir,'-B','--bob','--rbf'] + out_addr) + t = self.spawn('mmgen-txcreate',['-d',self.tr.trash_dir,'-B','--bob'] + out_addr) return self.txcreate_ui_common(t,menu=[],inputs='3',interactive_fee='3s') # out amt: 199.99999343 def bob_rbf_1output_bump(self): @@ -1006,7 +1006,7 @@ class CmdTestRegtest(CmdTestBase,CmdTestShared): outputs_cl = self._create_tx_outputs('alice',(('L',1,',60'),('C',1,',40'))) # alice_sid:L:1, alice_sid:C:1 outputs_cl += [self._user_sid('bob')+':'+rtBobOp3] return self.user_txdo('bob',rtFee[1],outputs_cl,'3', - extra_args = ([],['--rbf'])[self.proto.cap('rbf')], + extra_args = (['--no-rbf'],[])[self.proto.cap('rbf')], used_chg_addr_resp = 'y' ) def bob_send_non_mmgen(self):