minor fixes and cleanups
This commit is contained in:
parent
6df695024e
commit
0b833dadea
7 changed files with 20 additions and 20 deletions
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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}'))
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue