diff --git a/mmgen/proto/btc/tx/info.py b/mmgen/proto/btc/tx/info.py index 30604e18..fb950f81 100755 --- a/mmgen/proto/btc/tx/info.py +++ b/mmgen/proto/btc/tx/info.py @@ -69,6 +69,8 @@ class TxInfo(TxInfo): }[sort] if terse: iwidth = max(len(str(int(e.amt))) for e in io) + else: + col1_w = len(str(len(io))) + 1 for n,e in enumerate(io_sorted()): if is_input and blockcount: confs = e.confs + blockcount - tx.blockcount @@ -103,7 +105,7 @@ class TxInfo(TxInfo): yield ('', 'confirmations:', f'{confs} (around {days} days)') if not is_input and e.is_chg: yield ('', 'change:', green('True')) - yield '\n'.join('{:>3} {:<8} {}'.format(*d) for d in gen()) + '\n\n' + yield '\n'.join('{:>{w}} {:<8} {}'.format(*d,w=col1_w) for d in gen()) + '\n\n' addr_w = max(len(e.addr) for f in (tx.inputs,tx.outputs) for e in f) diff --git a/mmgen/tx/completed.py b/mmgen/tx/completed.py index 151299c4..08cbb46f 100755 --- a/mmgen/tx/completed.py +++ b/mmgen/tx/completed.py @@ -27,8 +27,7 @@ class Completed(Base): super().__init__(cfg=cfg,*args,**kwargs) if data: - data['twctl'] = self.twctl - self.__dict__ = data + self.__dict__ = data | {'twctl': self.twctl} self.name = type(self).__name__ else: from .file import MMGenTxFile diff --git a/mmgen/util.py b/mmgen/util.py index 6a144460..7ef68bf7 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -179,9 +179,13 @@ def pp_fmt(d): def pp_msg(d): msg(pp_fmt(d)) +def indent(s,indent=' ',append='\n'): + "indent multiple lines of text with specified string" + return indent + ('\n'+indent).join(s.strip().splitlines()) + append + def fmt(s,indent='',strip_char=None,append='\n'): "de-indent multiple lines of text, or indent with specified string" - return indent + ('\n'+indent).join([l.strip(strip_char) for l in s.strip().splitlines()]) + append + return indent + ('\n'+indent).join([l.lstrip(strip_char) for l in s.strip().splitlines()]) + append def fmt_list(iterable,fmt='dfl',indent='',conv=None): "pretty-format a list" diff --git a/scripts/exec_wrapper.py b/scripts/exec_wrapper.py index aa1fd44d..7e59d815 100755 --- a/scripts/exec_wrapper.py +++ b/scripts/exec_wrapper.py @@ -81,7 +81,7 @@ def exec_wrapper_write_traceback(e,exit_val): def exec_wrapper_end_msg(): if ( - exec_wrapper_os.getenv('EXEC_WRAPPER_SPAWN') + exec_wrapper_os.getenv('EXEC_WRAPPER_DO_RUNTIME_MSG') and not exec_wrapper_os.getenv('MMGEN_TEST_SUITE_DETERMINISTIC') ): c = exec_wrapper_get_colors() # write to stdout to ensure script output gets to terminal first diff --git a/test/cmdtest.py b/test/cmdtest.py index 2c10b017..50fc046a 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -590,7 +590,7 @@ class CmdTestRunner: 'MMGEN_NO_LICENSE': '1', 'MMGEN_BOGUS_SEND': '1', 'MMGEN_TEST_SUITE_PEXPECT': '1', - 'EXEC_WRAPPER_SPAWN':'1', + 'EXEC_WRAPPER_DO_RUNTIME_MSG':'1', # if cmdtest.py itself is running under exec_wrapper, disable writing of traceback file for spawned script 'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_EXEC_WRAPPER') else '1', }) @@ -615,6 +615,7 @@ class CmdTestRunner: pexpect_spawn = None, direct_exec = False, no_passthru_opts = False, + spawn_env_override = None, env = {}): desc = self.tg.test_name if cfg.names else self.gm.dpy_data[self.tg.test_name][1] @@ -679,7 +680,7 @@ class CmdTestRunner: send_delay = 0.4 if pexpect_spawn is True or cfg.buf_keypress else None pexpect_spawn = pexpect_spawn if pexpect_spawn is not None else bool(cfg.pexpect_spawn) - spawn_env = dict(self.tg.spawn_env) + spawn_env = dict(spawn_env_override or self.tg.spawn_env) spawn_env.update({ 'MMGEN_HOLD_PROTECT_DISABLE': '' if send_delay else '1', 'MMGEN_TEST_SUITE_POPEN_SPAWN': '' if pexpect_spawn else '1', diff --git a/test/cmdtest_py_d/ct_autosign.py b/test/cmdtest_py_d/ct_autosign.py index c056bcde..262165d8 100755 --- a/test/cmdtest_py_d/ct_autosign.py +++ b/test/cmdtest_py_d/ct_autosign.py @@ -182,7 +182,8 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase): 'mmgen-autosign', self.opts + ['--full-summary','wait'], direct_exec = True, - no_passthru_opts = True) + no_passthru_opts = True, + spawn_env_override = self.spawn_env | {'EXEC_WRAPPER_DO_RUNTIME_MSG': ''}) self.write_to_tmpfile('autosign_thread_pid',str(t.ep.pid)) import threading threading.Thread(target=run, name='Autosign wait loop').start() diff --git a/test/cmdtest_py_d/ct_ethdev.py b/test/cmdtest_py_d/ct_ethdev.py index 820cfde5..bbaf0e45 100755 --- a/test/cmdtest_py_d/ct_ethdev.py +++ b/test/cmdtest_py_d/ct_ethdev.py @@ -1155,13 +1155,14 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared): def token_bal1(self): return self.token_bal(n='1') - def token_txcreate(self,args=[],token='',inputs='1',fee='50G'): + def token_txcreate(self,args=[],token='',inputs='1',fee='50G',file_desc='Unsigned transaction'): return self.txcreate_ui_common( self.spawn('mmgen-txcreate', self.eth_args + ['--token='+token,'-B','--fee='+fee] + args), menu = [], inputs = inputs, input_sels_prompt = 'to spend from', - add_comment = tx_comment_lat_cyr_gr ) + add_comment = tx_comment_lat_cyr_gr, + file_desc = file_desc) def token_txsign(self,ext='',token=''): return self.txsign(ni=True,ext=ext,add_args=['--token='+token]) def token_txsend(self,ext='',token=''):