From 7e5ee50d0b7e4c14ff83a786663d9d03ec0e93cf Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 15 Mar 2025 18:24:53 +0000 Subject: [PATCH] tx.new: minor fixes --- mmgen/proto/btc/tx/new.py | 1 + mmgen/tw/unspent.py | 3 ++- mmgen/tx/new.py | 11 +++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mmgen/proto/btc/tx/new.py b/mmgen/proto/btc/tx/new.py index 48f97ace..5c89ad72 100755 --- a/mmgen/proto/btc/tx/new.py +++ b/mmgen/proto/btc/tx/new.py @@ -22,6 +22,7 @@ class New(Base, TxNew): usr_fee_prompt = 'Enter transaction fee: ' fee_fail_fs = 'Network fee estimation for {c} confirmations failed ({t})' no_chg_msg = 'Warning: Change address will be deleted as transaction produces no change' + msg_insufficient_funds = 'Selected outputs insufficient to fund this transaction ({} {} needed)' def process_data_output_arg(self, arg): if any(arg.startswith(pfx) for pfx in ('data:', 'hexdata:')): diff --git a/mmgen/tw/unspent.py b/mmgen/tw/unspent.py index 9af953dc..ca81662d 100755 --- a/mmgen/tw/unspent.py +++ b/mmgen/tw/unspent.py @@ -206,10 +206,11 @@ class TwUnspentOutputs(TwView): c = d.comment.fmt2(cw.comment, color=color, nullrepl='-')) def display_total(self): - msg('\nTotal unspent: {} {} ({} output{})'.format( + msg('\nTotal unspent: {} {} ({} {}{})'.format( self.total.hl(), self.proto.dcoin, len(self.data), + self.item_desc, suf(self.data))) async def set_dates(self, us): diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index c0fa06ab..36504e01 100755 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -85,7 +85,6 @@ class New(Base): ERROR: No change address specified. If you wish to create a transaction with only one output, specify a single output address with no {} amount """ - msg_insufficient_funds = 'Selected outputs insufficient to fund this transaction ({} {} needed)' chg_autoselected = False _funds_available = namedtuple('funds_available', ['is_positive', 'amt']) @@ -388,7 +387,10 @@ class New(Base): self.get_unspent_nums_from_user )(self.twuo.data) - msg(f'Selected output{suf(sel_nums)}: {{}}'.format(' '.join(str(n) for n in sel_nums))) + msg('Selected {}{}: {}'.format( + self.twuo.item_desc, + suf(sel_nums), + ' '.join(str(n) for n in sel_nums))) sel_unspent = MMGenList(self.twuo.data[i-1] for i in sel_nums) if not await self.precheck_sufficient_funds( @@ -481,10 +483,11 @@ class New(Base): fee_hint = self.update_vault_output( self.vault_output.amt or self.sum_inputs(), deduct_est_fee = self.vault_output == self.chg_output) - if funds_left := await self.get_fee( + desc = 'User-selected' if self.cfg.fee else 'Recommended' if fee_hint else None + if (funds_left := await self.get_fee( self.cfg.fee or fee_hint, outputs_sum, - 'User-selected' if self.cfg.fee else 'Recommended' if fee_hint else None): + desc)) is not None: break self.check_non_mmgen_inputs(caller)