From ad1286ab978162351ef0abc8c90d2c512a720a5f Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 26 Nov 2022 18:55:54 +0000 Subject: [PATCH] option rename: --tx-fee -> --fee This change breaks compatibility. Scripts may need to be adjusted. --- mmgen/main_split.py | 4 ++-- mmgen/main_txbump.py | 6 +++--- mmgen/main_txcreate.py | 2 +- mmgen/main_txdo.py | 2 +- mmgen/tx/new.py | 4 ++-- test/test_py_d/ts_ethdev.py | 10 +++++----- test/test_py_d/ts_regtest.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mmgen/main_split.py b/mmgen/main_split.py index 2130a74d..cc91fd16 100755 --- a/mmgen/main_split.py +++ b/mmgen/main_split.py @@ -116,8 +116,8 @@ from .protocol import init_proto if opt.tx_fees: for idx,g_coin in ((1,opt.other_coin),(0,proto.coin)): proto = init_proto(g_coin) - opt.tx_fee = opt.tx_fees.split(',')[idx] - opts.opt_is_tx_fee('foo',opt.tx_fee,'transaction fee') # raises exception on error + opt.fee = opt.tx_fees.split(',')[idx] + opts.opt_is_tx_fee('foo',opt.fee,'transaction fee') # raises exception on error tx1 = MMGenSplitTX() opt.no_blank = True diff --git a/mmgen/main_txbump.py b/mmgen/main_txbump.py index 1835d512..2b30ef1c 100755 --- a/mmgen/main_txbump.py +++ b/mmgen/main_txbump.py @@ -41,7 +41,7 @@ opts_data = { -c, --comment-file= f Source the transaction's comment from file 'f' -d, --outdir= d Specify an alternate directory 'd' for output -e, --echo-passphrase Print passphrase to screen when typing it --f, --tx-fee= f Transaction fee, as a decimal {cu} amount or as +-f, --fee= f Transaction fee, as a decimal {cu} amount or as {fu} (an integer followed by {fl!r}). See FEE SPECIFICATION below. -H, --hidden-incog-input-params=f,o Read hidden incognito data from file @@ -114,7 +114,7 @@ seed_files = get_seed_files(opt,cmd_args) if (cmd_args or opt.send) else None from .ui import do_license_msg do_license_msg() -silent = opt.yes and opt.tx_fee != None and opt.output_to_reduce != None +silent = opt.yes and opt.fee != None and opt.output_to_reduce != None from .tx import CompletedTX,BumpTX,UnsignedTX,OnlineSignedTX @@ -148,7 +148,7 @@ async def main(): if not silent: msg(f'Minimum fee for new transaction: {tx.min_fee.hl()} {tx.proto.coin}') - tx.usr_fee = tx.get_usr_fee_interactive(tx_fee=opt.tx_fee,desc='User-selected') + tx.usr_fee = tx.get_usr_fee_interactive(tx_fee=opt.fee,desc='User-selected') tx.bump_fee(output_idx,tx.usr_fee) diff --git a/mmgen/main_txcreate.py b/mmgen/main_txcreate.py index 93f3e9a1..3a8b8696 100755 --- a/mmgen/main_txcreate.py +++ b/mmgen/main_txcreate.py @@ -40,7 +40,7 @@ opts_data = { -D, --contract-data=D Path to hex-encoded contract data (ETH only) -E, --fee-estimate-mode=M Specify the network fee estimate mode. Choices: {fe_all}. Default: {fe_dfl!r} --f, --tx-fee= f Transaction fee, as a decimal {cu} amount or as +-f, --fee= f Transaction fee, as a decimal {cu} amount or as {fu} (an integer followed by {fl!r}). See FEE SPECIFICATION below. If omitted, fee will be calculated using network fee estimation. diff --git a/mmgen/main_txdo.py b/mmgen/main_txdo.py index de7b243b..3a14adbf 100755 --- a/mmgen/main_txdo.py +++ b/mmgen/main_txdo.py @@ -44,7 +44,7 @@ opts_data = { -e, --echo-passphrase Print passphrase to screen when typing it -E, --fee-estimate-mode=M Specify the network fee estimate mode. Choices: {fe_all}. Default: {fe_dfl!r} --f, --tx-fee= f Transaction fee, as a decimal {cu} amount or as +-f, --fee= f Transaction fee, as a decimal {cu} amount or as {fu} (an integer followed by {fl!r}). See FEE SPECIFICATION below. If omitted, fee will be calculated using network fee estimation. diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index 97942023..5957b404 100755 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -145,9 +145,9 @@ class New(Base): async def get_fee_from_user(self,have_estimate_fail=[]): - if opt.tx_fee: + if opt.fee: desc = 'User-selected' - start_fee = opt.tx_fee + start_fee = opt.fee else: desc = 'Network-estimated ({}, {} conf{})'.format( opt.fee_estimate_mode.upper(), diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index 060de318..ab8f300b 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -921,7 +921,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): fn = joinpath(self.tmpdir,'mm'+str(num),key+'.bin') args = [ '-B', - f'--tx-fee={tx_fee}', + f'--fee={tx_fee}', f'--tx-gas={gas}', f'--contract-data={fn}', f'--inputs={dfl_devaddr}', @@ -1067,7 +1067,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): def token_txcreate(self,args=[],token='',inputs='1',fee='50G'): return self.txcreate_ui_common( - self.spawn('mmgen-txcreate', self.eth_args + ['--token='+token,'-B','--tx-fee='+fee] + args), + self.spawn('mmgen-txcreate', self.eth_args + ['--token='+token,'-B','--fee='+fee] + args), menu = [], inputs = inputs, input_sels_prompt = 'to spend from', @@ -1180,17 +1180,17 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): return self.twview(args=['--token=mm1','--cached-balances']) def txcreate_cached_balances(self): - args = ['--tx-fee=20G','--cached-balances','98831F3A:E:3,0.1276'] + args = ['--fee=20G','--cached-balances','98831F3A:E:3,0.1276'] return self.txcreate(args=args,acct='2') def token_txcreate_cached_balances(self): - args=['--cached-balances','--tx-fee=12G','98831F3A:E:12,1.2789'] + args=['--cached-balances','--fee=12G','98831F3A:E:12,1.2789'] return self.token_txcreate(args=args,token='mm1') def txdo_cached_balances(self, acct = '2', fee_res_data = ('0.00105','50'), add_args = ['98831F3A:E:3,0.4321']): - args = ['--tx-fee=20G','--cached-balances'] + add_args + [dfl_words_file] + args = ['--fee=20G','--cached-balances'] + add_args + [dfl_words_file] t = self.txcreate(args=args,acct=acct,caller='txdo',fee_res_data=fee_res_data,no_read=True) self._do_confirm_send(t,quiet=not g.debug,sure=False) return t diff --git a/test/test_py_d/ts_regtest.py b/test/test_py_d/ts_regtest.py index 5f42c57f..7fe01939 100755 --- a/test/test_py_d/ts_regtest.py +++ b/test/test_py_d/ts_regtest.py @@ -802,7 +802,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared): t = self.spawn('mmgen-txdo', ['-d',self.tmpdir,'-B','--'+user] + - (['--tx-fee='+fee] if fee else []) + + (['--fee='+fee] if fee else []) + extra_args + ([],[wf])[bool(wf)] + outputs_cl) self.txcreate_ui_common(t, @@ -889,7 +889,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared): if not self.proto.cap('rbf'): return 'skip' t = self.spawn('mmgen-txbump', - ['-d',outdir,'--'+user,'--tx-fee='+fee,'--output-to-reduce=c'] + add_args + [txfile]) + ['-d',outdir,'--'+user,'--fee='+fee,'--output-to-reduce=c'] + add_args + [txfile]) if not one_output: t.expect('OK? (Y/n): ','y') # output OK? t.expect('OK? (Y/n): ','y') # fee OK?