option rename: --tx-fee-adj -> --fee-adjust

This change breaks compatibility.  Scripts may need to be adjusted.
This commit is contained in:
The MMGen Project 2022-11-26 18:55:54 +00:00
commit 3f79be6dac
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
9 changed files with 14 additions and 14 deletions

View file

@ -65,7 +65,7 @@
# Set the transaction fee adjustment factor. Auto-calculated fees are
# multiplied by this value:
# tx_fee_adj 1.0
# fee_adjust 1.0
# Set the maximum transaction file size:
# max_tx_file_size 100000

View file

@ -67,7 +67,7 @@ class GlobalContext(Lockable):
dfl_hash_preset = '3'
usr_randchars = 30
tx_fee_adj = 1.0
fee_adjust = 1.0
fee_estimate_confs = 3
# Constant vars - some of these might be overridden in opts.py, but they don't change thereafter
@ -155,7 +155,7 @@ class GlobalContext(Lockable):
'minconf',
'quiet',
'fee_estimate_confs',
'tx_fee_adj',
'fee_adjust',
'use_internal_keccak_module',
'usr_randchars' )
@ -199,6 +199,7 @@ class GlobalContext(Lockable):
'color',
'daemon_data_dir',
'debug',
'fee_adjust',
'force_256_color',
'hash_preset',
'http_timeout',
@ -217,7 +218,6 @@ class GlobalContext(Lockable):
'rpc_user',
'subseeds',
'testnet',
'tx_fee_adj',
'usr_randchars',
'bch_max_tx_fee',
'btc_max_tx_fee',

View file

@ -192,7 +192,7 @@ SPECIFICATION below), it will be calculated dynamically using network fee
estimation for the default (or user-specified) number of confirmations.
If network fee estimation fails, the user will be prompted for a fee.
Network-estimated fees will be multiplied by the value of --tx-fee-adj, if
Network-estimated fees will be multiplied by the value of --fee-adjust, if
specified.
To send the value of all inputs (minus TX fee) to a single output, specify

View file

@ -31,7 +31,7 @@ opts_data = {
'options': """
-h, --help Print this help message
--, --longhelp Print help message for long options (common options)
-a, --tx-fee-adj= f Adjust transaction fee by factor 'f' (see below)
-a, --fee-adjust= f Adjust transaction fee by factor 'f' (see below)
-B, --no-blank Don't blank screen before displaying unspent outputs
-c, --comment-file=f Source the transaction's comment from file 'f'
-C, --fee-estimate-confs=c Desired number of confirmations for fee estimation

View file

@ -32,7 +32,7 @@ opts_data = {
'options': """
-h, --help Print this help message
--, --longhelp Print help message for long options (common options)
-a, --tx-fee-adj= f Adjust transaction fee by factor 'f' (see below)
-a, --fee-adjust= f Adjust transaction fee by factor 'f' (see below)
-b, --brain-params=l,p Use seed length 'l' and hash preset 'p' for
brainwallet input
-B, --no-blank Don't blank screen before displaying unspent outputs

View file

@ -54,13 +54,13 @@ class New(Base,TxBase.New):
from decimal import Decimal
tx_size = self.estimate_size()
ret = self.proto.coin_amt(
fee_per_kb * Decimal(opt.tx_fee_adj) * tx_size / 1024,
fee_per_kb * Decimal(opt.fee_adjust) * tx_size / 1024,
from_decimal = True )
if opt.verbose:
msg(fmt(f"""
{fe_type.upper()} fee for {opt.fee_estimate_confs} confirmations: {fee_per_kb} {self.coin}/kB
TX size (estimated): {tx_size} bytes
Fee adjustment factor: {opt.tx_fee_adj:.2f}
Fee adjustment factor: {opt.fee_adjust:.2f}
Absolute fee (fee_per_kb * adj_factor * tx_size / 1024): {ret} {self.coin}
""").strip())
return ret

View file

@ -116,9 +116,9 @@ class New(Base,TxBase.New):
from_unit='wei'
)
# given fee estimate (gas price) in wei, return absolute fee, adjusting by opt.tx_fee_adj
# given fee estimate (gas price) in wei, return absolute fee, adjusting by opt.fee_adjust
def fee_est2abs(self,rel_fee,fe_type=None):
ret = self.fee_gasPrice2abs(rel_fee) * opt.tx_fee_adj
ret = self.fee_gasPrice2abs(rel_fee) * opt.fee_adjust
if opt.verbose:
msg(f'Estimated fee: {ret} ETH')
return ret

View file

@ -117,8 +117,8 @@ class New(Base):
if abs_fee:
prompt = '{} TX fee{}: {}{} {} ({} {})\n'.format(
desc,
(f' (after {opt.tx_fee_adj:.2f}X adjustment)'
if opt.tx_fee_adj != 1 and desc.startswith('Network-estimated')
(f' (after {opt.fee_adjust:.2f}X adjustment)'
if opt.fee_adjust != 1 and desc.startswith('Network-estimated')
else ''),
('','')[self.fee_is_approximate],
abs_fee.hl(),

View file

@ -85,7 +85,7 @@ tests = {
{'num':Decimal('1.234'),'from_decimal':True,'ret':Decimal('1.234')},
{'num':Decimal('0.0'),'from_decimal':True,'ret':Decimal('0')},
# emulate network fee estimation:
# BTC/kB tx_fee_adj tx size
# BTC/kB fee_adjust tx size
{ 'num':Decimal('0.00053249') * Decimal('0.9') * 109 / 1024 , # ≈53 sat/byte
'from_decimal':True,
'ret':Decimal('0.00005101') },