From 034c3a7355112874985b5fe92358022950e47489 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 11 Sep 2026 14:10:55 +0000 Subject: [PATCH] tx.completed, cmdtest.py autosign_automount: minor fixes, param renames --- mmgen/tx/completed.py | 2 +- test/cmdtest_d/automount.py | 30 +++++++++++++++++------------- test/cmdtest_d/autosign.py | 3 ++- test/cmdtest_d/ref.py | 8 ++++++-- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/mmgen/tx/completed.py b/mmgen/tx/completed.py index d1dbec8d..bc6b660e 100755 --- a/mmgen/tx/completed.py +++ b/mmgen/tx/completed.py @@ -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: diff --git a/test/cmdtest_d/automount.py b/test/cmdtest_d/automount.py index 4108493f..b3ae1d2d 100755 --- a/test/cmdtest_d/automount.py +++ b/test/cmdtest_d/automount.py @@ -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') diff --git a/test/cmdtest_d/autosign.py b/test/cmdtest_d/autosign.py index 1fb96117..3d5dffc4 100755 --- a/test/cmdtest_d/autosign.py +++ b/test/cmdtest_d/autosign.py @@ -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 diff --git a/test/cmdtest_d/ref.py b/test/cmdtest_d/ref.py index 7ca02f0e..3f8e5fc3 100755 --- a/test/cmdtest_d/ref.py +++ b/test/cmdtest_d/ref.py @@ -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}'