diff --git a/mmgen/addr.py b/mmgen/addr.py index f9f3245c..c760e876 100755 --- a/mmgen/addr.py +++ b/mmgen/addr.py @@ -117,10 +117,10 @@ class AddrListID(HiliteStr, InitErrors, MMGenObject): me.mmtype = mmtype return me except Exception as e: - return cls.init_fail(e, f'sid={sid}, mmtype={mmtype}') + return cls.init_fail(e, f'sid={sid}, mmtype={mmtype}, id_str={id_str}') def is_addrlist_id(proto, s): - return get_obj(AddrListID, proto=proto, id_str=s, silent=False, return_bool=True) + return get_obj(AddrListID, proto=proto, id_str=s, silent=True, return_bool=True) class MMGenID(HiliteStr, InitErrors, MMGenObject): color = 'orange' diff --git a/mmgen/proto/btc/tx/new_swap.py b/mmgen/proto/btc/tx/new_swap.py index 5a8ca6c3..8e62b92b 100755 --- a/mmgen/proto/btc/tx/new_swap.py +++ b/mmgen/proto/btc/tx/new_swap.py @@ -20,8 +20,4 @@ class NewSwap(New, TxNewSwap): async def process_swap_cmdline_args(self, cmd_args): import sys - from ....util import msg - msg(' '.join(cmd_args)) sys.exit(0) - raise NotImplementedError('Work in Progress!') - return cmd_args diff --git a/mmgen/tx/base.py b/mmgen/tx/base.py index 8dd3f560..c6998e10 100755 --- a/mmgen/tx/base.py +++ b/mmgen/tx/base.py @@ -79,6 +79,7 @@ class Base(MMGenObject): locktime = None chain = None signed = False + file_format = 'json' non_mmgen_inputs_msg = f""" This transaction includes inputs with non-{gc.proj_name} addresses. When signing the transaction, private keys for the addresses listed below must @@ -89,7 +90,6 @@ class Base(MMGenObject): Non-{gc.proj_name} addresses found in inputs: {{}} """ - file_format = 'json' class Input(MMGenTxIO): scriptPubKey = ListItemAttr(HexStr) diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index 3a14eff6..f396760e 100755 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -249,6 +249,7 @@ class New(Base): die(2, 'At least one output must be specified on the command line') self.add_mmaddrs_to_outputs(ad_f, ad_w) + self.check_dup_addrs('outputs') if self.chg_output is not None: diff --git a/test/cmdtest_d/ct_autosign.py b/test/cmdtest_d/ct_autosign.py index c3970c6c..d80a1a63 100755 --- a/test/cmdtest_d/ct_autosign.py +++ b/test/cmdtest_d/ct_autosign.py @@ -458,16 +458,7 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase): return 'silent' def wait_loop_kill(self): - self.spawn('', msg_only=True) - pid = int(self.read_from_tmpfile('autosign_thread_pid')) - self.delete_tmpfile('autosign_thread_pid') - from signal import SIGTERM - imsg(purple(f'Killing autosign wait loop [PID {pid}]')) - try: - os.kill(pid, SIGTERM) - except: - imsg(yellow(f'{pid}: no such process')) - return 'ok' + return self._kill_process_from_pid_file('autosign_thread_pid', 'autosign wait loop') def _wait_signed(self, desc): oqmsg_r(gray(f'→ offline wallet{"s" if desc.endswith("s") else ""} waiting for {desc}')) diff --git a/test/cmdtest_d/ct_base.py b/test/cmdtest_d/ct_base.py index 39d68bdd..1ac0a920 100755 --- a/test/cmdtest_d/ct_base.py +++ b/test/cmdtest_d/ct_base.py @@ -23,9 +23,9 @@ test.cmdtest_d.ct_base: Base class for the cmdtest.py test suite import sys, os from mmgen.util import msg -from mmgen.color import gray +from mmgen.color import gray, purple, yellow -from ..include.common import cfg, write_to_file, read_from_file +from ..include.common import cfg, write_to_file, read_from_file, imsg from .common import get_file_with_ext class CmdTestBase: @@ -122,3 +122,15 @@ class CmdTestBase: def _cashaddr_opt(self, val): return [f'--cashaddr={val}'] if self.proto.coin == 'BCH' else [] + + def _kill_process_from_pid_file(self, fn, desc): + self.spawn('', msg_only=True) + pid = int(self.read_from_tmpfile(fn)) + self.delete_tmpfile(fn) + from signal import SIGTERM + imsg(purple(f'Killing {desc} [PID {pid}]')) + try: + os.kill(pid, SIGTERM) + except: + imsg(yellow(f'{pid}: no such process')) + return 'ok' diff --git a/test/cmdtest_d/ct_regtest.py b/test/cmdtest_d/ct_regtest.py index efeb7789..9cd88a83 100755 --- a/test/cmdtest_d/ct_regtest.py +++ b/test/cmdtest_d/ct_regtest.py @@ -1140,7 +1140,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): def bob_send_non_mmgen(self): keyfile = joinpath(self.tmpdir, 'non-mmgen.keys') atype = 'S' if self.proto.cap('segwit') else 'L' - outputs_cl = self._create_tx_outputs('alice', ((atype, 2, ', 10'), (atype, 3, ''))) + outputs_cl = self._create_tx_outputs('alice', ((atype, 2, ',10'), (atype, 3, ''))) return self.user_txdo( user = 'bob', fee = rtFee[3],