tx.completed, cmdtest.py autosign_automount: minor fixes, param renames

This commit is contained in:
The MMGen Project 2026-09-11 14:10:55 +00:00
commit 034c3a7355
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 26 additions and 17 deletions

View file

@ -110,7 +110,7 @@ class Completed(Base):
if self.cfg.is_signing:
a, b = ('sign', 'Has your online installation been compromised?')
elif self.cfg.is_sending:
a, b = ('send', 'Is your offline installation out of date?')
a, b = ('send', 'Is your offline installation compromised or out of date?')
elif not self.cfg.allow_legacy_tx_files:
a, b = ('operate on', 'Operation forbidden by ‘allow_legacy_tx_files false’')
else:

View file

@ -112,7 +112,10 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
def add_legacy_txfiles(self):
self.spawn(msg_only=True)
self.tx_file_ops('copy', txfile_coins=['btc', 'xmr'], tx_dir='txauto_dir')
self.tx_file_ops(
'copy',
txfile_coins = ['btc', 'xmr'],
tx_dir = 'txauto_dir')
return 'ok'
async def txview_allow_legacy(self):
@ -167,7 +170,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
def alice_txcreate4(self):
return self._user_txcreate('alice', chg_addr='L:4', need_rbf=True)
def _alice_txsend_abort(self, err=False, send_resp='y', expect=None, shred_expect=[]):
def _alice_txsend_abort(self, err=False, send_resp='y', expect_str=None, shred_expect_str=[]):
self.insert_device_online()
t = self.spawn(
'mmgen-txsend',
@ -175,29 +178,29 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
no_passthru_opts = ['coin'],
exit_val = 2 if err else 1 if send_resp == 'n' else None)
if err:
t.expect(expect)
t.expect(expect_str)
else:
t.expect('(y/N): ', send_resp)
if expect:
t.expect(expect)
for pat in shred_expect:
if expect_str:
t.expect(expect_str)
for pat in shred_expect_str:
t.expect(pat, regex=True)
t.read()
self.remove_device_online()
return t
def alice_txsend_abort1(self):
return self._alice_txsend_abort(shred_expect=['Shredding .*arawtx'])
return self._alice_txsend_abort(shred_expect_str=['Shredding .*arawtx'])
def alice_txsend_abort2(self):
return self._alice_txsend_abort(err=True, expect='No unsent transactions')
return self._alice_txsend_abort(err=True, expect_str='No unsent transactions')
def alice_txsend_abort3(self):
return self._alice_txsend_abort(send_resp='n', expect='Exiting at user request')
return self._alice_txsend_abort(send_resp='n', expect_str='Exiting at user request')
def alice_txsend_abort4(self):
self._wait_signed('transaction')
return self._alice_txsend_abort(shred_expect=[r'Shredding .*arawtx', r'Shredding .*asigtx'])
return self._alice_txsend_abort(shred_expect_str=[r'Shredding .*arawtx', r'Shredding .*asigtx'])
alice_txsend_abort5 = alice_txsend_abort2
@ -243,8 +246,9 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
def _alice_txstatus(
self,
expect,
expect_str,
exit_val = None,
*,
need_rbf = False,
tx_range = None,
verbose = True,
@ -261,7 +265,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
+ ([] if tx_range is None else [tx_range]),
no_passthru_opts = ['coin'],
exit_val = exit_val)
t.expect(expect, regex=True)
t.expect(expect_str, regex=True)
if not (exit_val or batch):
t.expect('view: ', 'n')
t.read()
@ -371,7 +375,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
def alice_txbump_abort1(self):
if not self.proto.cap('rbf'):
return 'skip'
return self._alice_txsend_abort(shred_expect=['Shredding .*arawtx'])
return self._alice_txsend_abort(shred_expect_str=['Shredding .*arawtx'])
def alice_txbump5(self):
sid = self._user_sid('alice')

View file

@ -249,7 +249,8 @@ class CmdTestAutosignBase(CmdTestBase):
if op != 'remove_signed':
shutil.copyfile(src, target)
try:
os.unlink(target.replace('.rawtx', '.sigtx'))
if target.endswith('.rawtx'):
os.unlink(target.replace('.rawtx', '.sigtx'))
except:
pass

View file

@ -343,8 +343,12 @@ class CmdTestRefTX(CmdTestRef):
def ref_txfile_sign(self):
self.write_to_tmpfile(pwfile, wpasswd)
idx = 1 if self.tn_ext else 0
return self.txsign(dfl_words_file, self._get_txfile(idx), save=False, has_label=True, view='y')
return self.txsign(
dfl_words_file,
self._get_txfile(0),
save = False,
has_label = True,
view = 'y')
def _ref_txfile_chk(self, cfgfile_lines=[], *, idx, ver=None, allowed=False):
expect_str = 'legacy-format' if ver is None else f'with version {ver}'