minor fixes and cleanups

This commit is contained in:
The MMGen Project 2026-11-01 12:51:05 +00:00
commit a000ca85d2
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 49 additions and 15 deletions

View file

@ -7,7 +7,7 @@
# https://gitlab.com/mmgen/mmgen-wallet
"""
tx.keys: transaction keys class for the MMGen suite
tx.keys: transaction signing keys class for the MMGen Project
"""
from ..cfg import gc
@ -69,7 +69,8 @@ class TxKeys:
key-address files for all MMGen addresses involved in the transaction must be
provided.
Verification of the swap memo against TX metadata is also performed.
For swap transactions, verification of the swap memo against TX metadata is
also performed.
"""
def __init__(
self,

View file

@ -22,6 +22,7 @@ class OpImportOutputs(OpWallet):
start_daemon = False
async def main(self, fn, wallet_idx, *, restart_daemon=True):
outputs_file = fn
if restart_daemon:
await self.restart_wallet_daemon()
h = MoneroWalletRPC(self, self.addr_data[0])
@ -34,17 +35,17 @@ class OpImportOutputs(OpWallet):
res = self.c.call(
'import_outputs',
outputs_data_hex = m.data.outputs_data_hex)
idata = res['num_imported']
bmsg(f'\n {idata} output{suf(idata)} imported')
count = res['num_imported']
bmsg(f'\n {count} output{suf(count)} imported')
if m.data.sign:
data = m.data._asdict()
data.update(self.c.call('export_key_images', all=True))
m = MoneroWalletOutputsFile.SignedNew(
parent = self,
wallet_fn = m.get_wallet_fn(fn),
wallet_fn = m.get_wallet_fn(outputs_file),
data = data)
idata = m.data.signed_key_images or []
bmsg(f' {len(idata)} key image{suf(idata)} signed')
kdata = m.data.signed_key_images or []
bmsg(f' {len(kdata)} key image{suf(kdata)} signed')
else:
m.data = m.data._replace(imported=True)
return m

View file

@ -665,8 +665,6 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase):
def wait_loop_kill(self):
self.spawn(msg_only=True)
if self.cfg.no_daemon_stop:
return 'skip_msg'
return self._kill_process_from_pid_file('autosign_thread_pid', 'autosign wait loop')
def _wait_signed(self, desc):

View file

@ -546,11 +546,11 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
('user_twview2', 'viewing user’s tracking wallets (reload, sort options)'),
('user_twview_chk1', 'viewing user’s tracking wallets (check balances)'),
('user_listaddresses_sort', 'listing user’s addresses (sort options)'),
('wait_loop_start_compat', 'starting autosign wait loop in XMR compat mode [--coins=xmr]'),
('user_txcreate1_bad', 'creating a transaction (bad, no amount)'),
('user_txcreate1', 'creating a transaction'),
('user_txabort1', 'aborting the transaction'),
('user_txcreate2', 'recreating the transaction'),
('wait_loop_start_compat', 'starting autosign wait loop in XMR compat mode [--coins=xmr]'),
('wait_signed1', 'autosigning the transaction'),
('wait_loop_kill', 'stopping autosign wait loop'),
('user_txabort2', 'aborting the raw and signed transactions'),

View file

@ -213,6 +213,7 @@ class CmdTestXMRSwap(CmdTestXMRSwapMethods, CmdTestSwap):
('swaptxsend_refreq7', 'sending the transaction'),
('swaptxcreate_refnum7_bad', 'creating an XMR->LTC swap transaction (bad, no amount)'),
('swaptxcreate_refnum7', 'creating an XMR->LTC swap transaction (auto chg, auto dest)'),
('xmr_swaptxview_refnum7', ''),
('swaptxsend_refnum7', 'sending the transaction'),
('swaptxstatus_refnum7a', 'getting the transaction status (mempool)'),
('xmr_mine_blocks_10', ''),
@ -380,6 +381,7 @@ class CmdTestXMRSwapXMR(CmdTestXMRSwapMethods, CmdTestSwapMethods, CmdTestXMRCom
('new_address_user1', 'adding an address to user’s wallet (acct 0)'),
('new_address_user2', 'adding an address to user’s wallet (acct 0)'),
('new_account_user', 'adding an account to user’s wallet'),
('swaptxview_refnum7', 'viewing the transaction'),
('user_listaddresses_refresh', 'listing the user’s wallet, with refresh'))
def user_txcreate_sweep1(self):
@ -404,3 +406,14 @@ class CmdTestXMRSwapXMR(CmdTestXMRSwapMethods, CmdTestSwapMethods, CmdTestXMRCom
'stop',
r'Creating new account for wallet .*1.* with label '
r'.*‘xmrwallet new account .*y/N\): ')
def swaptxview_refnum7(self):
self.insert_device_online()
self.do_mount_online()
tdir = self.asi_online.mountpoint / 'txauto'
files = [str(p) for p in tdir.glob('*XMR*rawtx')]
t = self.spawn('mmgen-tool', ['txview'] + files)
t.read()
self.do_umount_online()
self.remove_device_online()
return t

View file

@ -64,7 +64,7 @@ def stop_miner_wallet_daemon(self):
class CmdTestXMRWallet(CmdTestBase):
"""
Monero wallet operations
Monero legacy wallet operations
"""
networks = ('xmr',)
@ -482,6 +482,7 @@ class CmdTestXMRWallet(CmdTestBase):
op,
user,
arg2,
*,
tx_relay_parm = None,
no_relay = False,
use_existing = False,
@ -544,7 +545,12 @@ class CmdTestXMRWallet(CmdTestBase):
return await self.mine_chk('alice', 3, 0, lambda x: x.ub > 1, 'unlocked balance > 1')
async def sweep_to_wallet_account_proxy(self):
self.do_op('sweep', 'alice', '3:0,2:1', self.tx_relay_daemon_proxy_parm, add_opts=['--priority=3', '-Ee'])
self.do_op(
'sweep',
'alice',
'3:0,2:1',
tx_relay_parm = self.tx_relay_daemon_proxy_parm,
add_opts = ['--priority=3', '-Ee'])
return await self.mine_chk('alice', 2, 1, lambda x: x.ub > 1, 'unlocked balance > 1')
async def sweep_to_same_account_noproxy(self):
@ -554,7 +560,11 @@ class CmdTestXMRWallet(CmdTestBase):
async def transfer_to_miner_proxy(self):
addr = read_from_file(self.users['miner'].addrfile_fs.format(2))
amt = '0.135'
self.do_op('transfer', 'alice', f'2:1:{addr},{amt}', self.tx_relay_daemon_proxy_parm)
self.do_op(
'transfer',
'alice',
f'2:1:{addr},{amt}',
tx_relay_parm = self.tx_relay_daemon_proxy_parm)
await self.stop_wallet_user('miner')
await self.open_wallet_user('miner', 2)
await self.mine_chk('miner', 2, 0, lambda x: str(x.ub) == amt, f'unlocked balance == {amt}')
@ -563,7 +573,12 @@ class CmdTestXMRWallet(CmdTestBase):
async def transfer_to_miner_noproxy(self):
addr = read_from_file(self.users['miner'].addrfile_fs.format(2))
self.do_op('transfer', 'alice', f'2:1:{addr},0.0995', self.tx_relay_daemon_parm, add_opts=['--full-address'])
self.do_op(
'transfer',
'alice',
f'2:1:{addr},0.0995',
tx_relay_parm = self.tx_relay_daemon_parm,
add_opts = ['--full-address'])
await self.mine_chk('miner', 2, 0, lambda x: str(x.ub) == '0.2345', 'unlocked balance == 0.2345')
ok()
return await self.mine_chk('alice', 2, 1, lambda x: x.ub > 0.9, 'unlocked balance > 0.9')
@ -571,7 +586,13 @@ class CmdTestXMRWallet(CmdTestBase):
def transfer_to_miner_create(self, amt):
get_file_with_ext(self.users['alice'].udir, 'sigtx', delete_all=True)
addr = read_from_file(self.users['miner'].addrfile_fs.format(2))
return self.do_op('transfer', 'alice', f'2:1:{addr},{amt}', no_relay=True, do_ret=True, add_opts=['-Ee'])
return self.do_op(
'transfer',
'alice',
f'2:1:{addr},{amt}',
no_relay = True,
do_ret = True,
add_opts = ['-Ee'])
def transfer_to_miner_create1(self):
return self.transfer_to_miner_create('0.0111')