cmdtest.py autosign_automount: check mmgen-txsend --status with legacy TX files

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

View file

@ -87,6 +87,8 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
('alice_txstatus7', 'getting transaction status (tx_range=1, replaced)'),
('alice_txstatus8', 'getting transaction status (tx_range=3, 2 confirmations)'),
('alice_txstatus9', 'getting transaction status (tx_range=0-3)'),
('alice_txstatus_allow_legacy', 'getting transaction status (check legacy TX files allowed)'),
('alice_txstatus_forbid_legacy', 'getting transaction status (check legacy TX files forbidden)'),
('alice_txbump6', 'bumping the next-to-last sent transaction (idx=1)'),
('generate', 'mining a block'),
('alice_bal2', 'checking Alice’s balance'),
@ -114,7 +116,8 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
self.spawn(msg_only=True)
self.tx_file_ops(
'copy',
txfile_coins = ['btc', 'xmr'],
txfile_coins = ['btc', 'ltc', 'xmr'],
extra_fn_data = (('litecoin', '27795D-LTC[1.23456,32].regtest.asubtx'),),
tx_dir = 'txauto_dir')
return 'ok'
@ -252,6 +255,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
need_rbf = False,
tx_range = None,
verbose = True,
expect_missing = False,
batch = False):
if need_rbf and not self.proto.cap('rbf'):
@ -265,10 +269,13 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
+ ([] if tx_range is None else [tx_range]),
no_passthru_opts = ['coin'],
exit_val = exit_val)
t.expect(expect_str, regex=True)
if not (exit_val or batch):
t.expect('view: ', 'n')
t.read()
if expect_missing:
assert expect_str not in t.read()
else:
t.expect(expect_str, regex=True)
if verbose and not (exit_val or batch):
t.expect('view: ', 'n')
t.read()
self.remove_device_online()
return t
@ -305,6 +312,22 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
verbose = False,
batch = True)
def alice_txstatus_allow_legacy(self):
return self._alice_txstatus_chk_legacy('true', True)
def alice_txstatus_forbid_legacy(self):
return self._alice_txstatus_chk_legacy('false', False)
def _alice_txstatus_chk_legacy(self, bool_val, expect_missing):
write_to_cfgfile([f'allow_legacy_tx_files {bool_val}'])
t = self._alice_txstatus(
'legacy-format',
expect_missing = expect_missing,
need_rbf = True,
verbose = False,
tx_range = '1')
return t
def alice_txsend_bad_no_unsent(self):
self.insert_device_online()
t = self.spawn('mmgen-txsend', ['--quiet', '--autosign'], exit_val=2, no_passthru_opts=['coin'])

View file

@ -224,7 +224,7 @@ class CmdTestAutosignBase(CmdTestBase):
if fn.endswith(f'[{coin.upper()}].rawmsg.json'):
yield os.path.join(sdir, fn)
def tx_file_ops(self, op, txfile_coins=[], tx_dir='tx_dir'):
def tx_file_ops(self, op, txfile_coins=[], tx_dir='tx_dir', extra_fn_data=()):
assert op in ('copy', 'set_count', 'remove_signed')
@ -240,7 +240,7 @@ class CmdTestAutosignBase(CmdTestBase):
self.do_mount(verbose=not self.tr.quiet)
end_silence()
for coindir, fn in fn_data:
for coindir, fn in (fn_data + extra_fn_data):
src = joinpath(ref_dir, coindir, fn)
if self.cfg.debug_utf8:
ext = '.testnet.rawtx' if fn.endswith('.testnet.rawtx') else '.rawtx'

View file

@ -0,0 +1,8 @@
b67332
LTC REGTEST 27795D 1.23456 20260910_122900 397
0200000001b1352b2f83739b4821559170bfffd35df0fc055d002c76b1244682f7c201267c010000006a47304402204678b74c8cce9029396f23fe0ea16d97382cfce820a75577c275d60695ef45b502201601aa89fb9715dbebc0c84853d48f62f713430adec61ca470150e7028d222210121028f8d2d29ca7495e93c2c474e18ed444365a2154316fb8d06b00ace3418470d09fdffffff0200ca5b07000000001976a914000000000000000000000000000000000000000088ace036d6ff7f0000001976a914f82d2dab4ba6f3a54e88a0a3ffcdcbf0cc8196cf88ac00000000
[{'txid': '7c2601c2f7824624b1762c005d05fcf05dd3ffbf70915521489b73832f2b35b1', 'vout': 1, 'scriptPubKey': '76a914b2ac4b97d13d662f15dcf68c29c4cd77effd25d488ac', 'comment': '', 'amt': '5498.76538592', 'addr': 'mwogyV9bGWwsMRYKkPTuxCAWhPfpipvKmQ', 'confs': 2, 'mmid': 'A1D38772:C:5', 'sequence': 4294967293}]
[{'addr': 'mfWxJ45yp2SFn7UciZyNpvDKrzbhyfKrY8', 'amt': '1.23456', 'is_chg': False}, {'addr': 'n49BzgGeXmbw94ioZ7niLS4HwZURdUMNwS', 'amt': '5497.53075424', 'is_chg': True, 'mmid': 'A1D38772:L:4'}]
-
93cc1d9b4815584c0599d1395a1e00113fdec13e307559bcabf6dd91b969b0a2
Sent 20260910_122910