From a68a87397b4c876fc3806117fba3aebc12ad00c4 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 11 Sep 2026 14:10:55 +0000 Subject: [PATCH] cmdtest.py autosign: new `autosign_txview()` method --- test/cmdtest_d/automount.py | 2 +- test/cmdtest_d/automount_eth.py | 2 +- test/cmdtest_d/autosign.py | 18 +++++------------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/test/cmdtest_d/automount.py b/test/cmdtest_d/automount.py index 247acdec..2cbafbf3 100755 --- a/test/cmdtest_d/automount.py +++ b/test/cmdtest_d/automount.py @@ -91,7 +91,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest): ('alice_bal2', 'checking Alice’s balance'), ('wait_loop_kill', 'stopping autosign wait loop'), ('stop', 'stopping regtest daemon'), - ('txview', 'viewing transactions'), + ('autosign_txview', 'viewing transactions on removable device'), ) def __init__(self, cfg, trunner, cfgs, spawn): diff --git a/test/cmdtest_d/automount_eth.py b/test/cmdtest_d/automount_eth.py index 23c22634..774f27db 100755 --- a/test/cmdtest_d/automount_eth.py +++ b/test/cmdtest_d/automount_eth.py @@ -49,7 +49,7 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev, CmdTestEthdevMe ('token_bal2', f'the {cfg.coin} balance and token balance'), ('wait_loop_kill', 'stopping autosign wait loop'), ('stop', 'stopping daemon'), - ('txview', 'viewing transactions'), + ('autosign_txview', 'viewing transactions on removable device'), ) def __init__(self, cfg, trunner, cfgs, spawn): diff --git a/test/cmdtest_d/autosign.py b/test/cmdtest_d/autosign.py index 9bc5fc75..bccd7f41 100755 --- a/test/cmdtest_d/autosign.py +++ b/test/cmdtest_d/autosign.py @@ -25,7 +25,7 @@ from subprocess import run, DEVNULL from pathlib import Path from mmgen.cfg import Config, gc -from mmgen.color import red, blue, cyan, orange, purple, gray +from mmgen.color import red, cyan, orange, purple, gray from mmgen.util import msg, suf, die, indent, fmt from mmgen.led import LEDControl from mmgen.autosign import Autosign @@ -667,23 +667,15 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase): def do_umount_online(self, *args, **kwargs): return self._mount_ops('asi_online', 'do_umount', *args, **kwargs) - async def txview(self): - self.spawn(msg_only=True) + async def autosign_txview(self): self.insert_device() self.do_mount() src = Path(self.asi.txauto_dir) - from mmgen.tx import CompletedTX - txs = sorted( - [await CompletedTX(cfg=self.cfg, filename=path, quiet_open=True) for path in sorted(src.iterdir())], - key = lambda x: x.timestamp) - for tx in txs: - if not tx.is_compat: - imsg(blue(f'\nViewing ‘{tx.infile.name}’:')) - out = tx.info.format(terse=True) - imsg(indent(out, indent=' ')) + t = self.spawn('mmgen-tool', ['txview'] + [str(fn) for fn in sorted(src.iterdir())]) + t.read() self.do_umount() self.remove_device() - return 'ok' + return t class CmdTestAutosign(CmdTestAutosignBase): 'autosigning transactions for all supported coins'