improve setting of is_signing, is_sending; cmdtest.py ref_tx: add test

This commit is contained in:
The MMGen Project 2026-09-11 14:10:55 +00:00
commit 106da66351
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 11 additions and 7 deletions

View file

@ -628,11 +628,6 @@ class Config(Lockable):
if hasattr(self, 'bch_cashaddr') and not hasattr(self, 'cashaddr'):
self.cashaddr = self.bch_cashaddr
if 'sign' in gc.prog_name:
self.is_signing = True
elif 'send' in gc.prog_name and not (hasattr(self, 'status') or hasattr(self, 'receipt')):
self.is_sending = True
self._lock()
if need_proto:

View file

@ -101,6 +101,7 @@ from .autosign import Autosign
cfg = Config(
opts_data = opts_data,
init_opts = {
'is_signing': True,
'out_fmt': 'wallet',
'usr_randchars': 0,
'hash_preset': '1',

View file

@ -30,6 +30,10 @@ opts_data = {
('yes', True, 'quiet', True),
('abort', True, 'autosign', True),
],
'overrides': [
('status', True, 'is_sending', False),
('receipt', True, 'is_sending', False),
],
'text': {
'desc': f'Send a signed {gc.proj_name} cryptocoin transaction',
'usage2': [
@ -87,7 +91,7 @@ recent.
}
}
cfg = Config(opts_data=opts_data)
cfg = Config(opts_data=opts_data, init_opts={'is_sending': True})
if cfg.autosign and cfg.outdir:
die(1, '--outdir cannot be used in combination with --autosign')

View file

@ -94,7 +94,7 @@ column below:{n_fc}"""
}
}
cfg = Config(opts_data=opts_data)
cfg = Config(opts_data=opts_data, init_opts={'is_signing': True})
if not cfg._args:
cfg._usage()

View file

@ -348,6 +348,7 @@ class CmdTestRefTX(CmdTestRef):
self._get_txfile(0),
save = False,
has_label = True,
expect_str = 'legacy-format',
view = 'y')
def _ref_txfile_chk(self, cfgfile_lines=[], *, idx, ver=None, allowed=False):

View file

@ -231,6 +231,7 @@ class CmdTestShared:
has_label = False,
extra_opts = [],
extra_desc = '',
expect_str = None,
view = 'n',
dfl_wallet = False):
opts = extra_opts + ['-d', self.tmpdir, txfile] + ([wf] if wf else [])
@ -242,6 +243,8 @@ class CmdTestShared:
no_passthru_opts = ['coin'],
exit_val = None if save or (wcls.enc and wcls.type != 'brain') else 1)
t.license()
if expect_str:
t.expect(expect_str)
t.view_tx(view)
if wcls.enc and wcls.type != 'brain':
t.passphrase(wcls.desc, self.wpasswd)