mmgen-txsend: unrecognize the --coin and --token options

This commit is contained in:
The MMGen Project 2025-03-17 10:16:18 +00:00
commit 3faef52096
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
9 changed files with 28 additions and 18 deletions

View file

@ -77,7 +77,7 @@ class GlobalConstants(Lockable):
'txbump': _cc(True, True, True, None, ['tw'], 'lmw'),
'txcreate': _cc(True, True, True, None, ['tw'], 'lmw'),
'txdo': _cc(True, True, True, None, ['tw'], 'lmw'),
'txsend': _cc(True, True, True, None, ['tw'], 'lmw'),
'txsend': _cc(True, True, False, '-rRb', ['tw'], 'lmw'),
'txsign': _cc(True, True, False, '-rRb', ['tw'], 'lmw'),
'walletchk': _cc(False, False, False, None, [], 'lmw'),
'walletconv': _cc(False, False, False, None, [], 'lmw'),

View file

@ -1 +1 @@
15.1.dev21
15.1.dev22

View file

@ -78,10 +78,6 @@ if cfg.mark_sent and not cfg.autosign:
if cfg.test and cfg.dump_hex:
die(1, '--test cannot be used in combination with --dump-hex')
if cfg.tx_proxy:
from .tx.tx_proxy import check_client
check_client(cfg)
if cfg.dump_hex and cfg.dump_hex != '-':
from .fileutil import check_outfile_dir
check_outfile_dir(cfg.dump_hex)
@ -125,6 +121,8 @@ async def post_send(tx):
async def main():
global cfg
if cfg.status and cfg.autosign:
tx = await si.get_last_created()
else:
@ -134,8 +132,14 @@ async def main():
automount = cfg.autosign,
quiet_open = True)
cfg = Config({'_clone': cfg, 'proto': tx.proto, 'coin': tx.proto.coin})
if cfg.tx_proxy:
from .tx.tx_proxy import check_client
check_client(cfg)
from .rpc import rpc_init
tx.rpc = await rpc_init(cfg, tx.proto)
tx.rpc = await rpc_init(cfg)
cfg._util.vmsg(f'Getting {tx.desc}{tx.infile}')

View file

@ -107,6 +107,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
t = self.spawn(
'mmgen-txsend',
['--quiet', '--abort'],
no_passthru_opts = ['coin'],
exit_val = 2 if err else 1 if send_resp == 'n' else None)
if err:
t.expect(expect)
@ -173,6 +174,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
t = self.spawn(
'mmgen-txsend',
['--alice', '--autosign', '--status', '--verbose'],
no_passthru_opts = ['coin'],
exit_val = exit_val)
t.expect(expect)
if not exit_val:
@ -199,7 +201,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
def alice_txsend_bad_no_unsent(self):
self.insert_device_online()
t = self.spawn('mmgen-txsend', ['--quiet', '--autosign'], exit_val=2)
t = self.spawn('mmgen-txsend', ['--quiet', '--autosign'], exit_val=2, no_passthru_opts=['coin'])
t.expect('No unsent transactions')
t.read()
self.remove_device_online()

View file

@ -99,7 +99,7 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev):
def send_tx(self, add_args=[]):
self._wait_signed('transaction')
self.insert_device_online()
t = self.spawn('mmgen-txsend', self.txop_opts + add_args)
t = self.spawn('mmgen-txsend', self.txop_opts + add_args, no_passthru_opts=['coin'])
t.view_tx('t')
t.expect('(y/N): ', 'n')
self._do_confirm_send(t, quiet=True)
@ -140,4 +140,4 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev):
return t
def send_token_tx(self):
return self.send_tx(add_args=['--token=MM1'])
return self.send_tx()

View file

@ -515,7 +515,8 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase):
else [])
self.insert_device_online()
t = self.spawn('mmgen-txsend', [f'--{user}', '--quiet', '--autosign'] + extra_opt)
t = self.spawn('mmgen-txsend',
[f'--{user}', '--quiet', '--autosign'] + extra_opt, no_passthru_opts=['coin'])
if mark_sent:
t.written_to_file('Sent automount transaction')

View file

@ -727,7 +727,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
def txsend(self, ext='{}.regtest.sigtx', add_args=[], test=False):
ext = ext.format('' if cfg.debug_utf8 else '')
txfile = self.get_file_with_ext(ext, no_dot=True)
t = self.spawn('mmgen-txsend', self.eth_args + add_args + [txfile])
t = self.spawn('mmgen-txsend', self.eth_args + add_args + [txfile], no_passthru_opts=['coin'])
self.txsend_ui_common(
t,
quiet = not cfg.debug,
@ -823,6 +823,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
t = self.spawn(
'mmgen-txsend',
self.eth_args + add_args + ['--status', txfile],
no_passthru_opts = ['coin'],
exit_val = exit_val)
t.expect(expect_str)
if expect_str2:
@ -1075,7 +1076,8 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
self.eth_args + ['--yes', '-k', keyfile, txfile], no_msg=True, no_passthru_opts=['coin'])
self.txsign_ui_common(t, ni=True)
txfile = txfile.replace('.rawtx', '.sigtx')
t = self.spawn('mmgen-txsend', self.eth_args + [txfile], no_msg=True)
t = self.spawn('mmgen-txsend',
self.eth_args + [txfile], no_msg=True, no_passthru_opts=['coin'])
txid = self.txsend_ui_common(t,
caller = mmgen_cmd,
@ -1241,7 +1243,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
def token_txsign(self, ext='', token='', add_args=[], ni=True):
return self.txsign(ni=ni, ext=ext, add_args=add_args)
def token_txsend(self, ext='', token=''):
return self.txsend(ext=ext, add_args=['--token='+token])
return self.txsend(ext=ext)
def token_txcreate1(self):
return self.token_txcreate(args=['98831F3A:E:12,1.23456'], token='mm1')
@ -1261,7 +1263,6 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
def tx_status3(self):
return self.tx_status(
ext = '1.23456,50000]{}.regtest.sigtx',
add_args = ['--token=mm1'],
expect_str = 'successfully executed',
expect_str2 = 'has 1 confirmation')

View file

@ -802,7 +802,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared):
return t
def txsend(self, sigfile, extra_opts=[]):
t = self.spawn('mmgen-txsend', extra_opts + ['-d', self.tmpdir, sigfile])
t = self.spawn('mmgen-txsend', extra_opts + ['-d', self.tmpdir, sigfile], no_passthru_opts=['coin'])
self.txsend_ui_common(t, view='t', add_comment='')
return t

View file

@ -1052,6 +1052,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
t = self.spawn(
'mmgen-txsend',
['-d', self.tmpdir, '--'+user, '--status'] + extra_args + [tx_file],
no_passthru_opts = ['coin'],
exit_val = exit_val)
if exp1:
t.expect(exp1, regex=True)
@ -2225,7 +2226,8 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
def _bob_dump_hex_dump(self, file):
txfile = get_file_with_ext(self.dump_hex_subdir, 'sigtx')
t = self.spawn('mmgen-txsend', ['-d', self.dump_hex_subdir, f'--dump-hex={file}', '--bob', txfile])
t = self.spawn('mmgen-txsend',
['-d', self.dump_hex_subdir, f'--dump-hex={file}', '--bob', txfile], no_passthru_opts=['coin'])
t.expect('view: ', '\n')
t.expect('(y/N): ', '\n') # add comment?
t.written_to_file('Sent transaction')
@ -2246,7 +2248,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
def bob_dump_hex_test(self):
txfile = get_file_with_ext(self.dump_hex_subdir, 'sigtx')
t = self.spawn('mmgen-txsend', ['--bob', '--test', txfile])
t = self.spawn('mmgen-txsend', ['--bob', '--test', txfile], no_passthru_opts=['coin'])
self.txsend_ui_common(t, bogus_send=False, test=True)
return t