From df7e8f0bcab16c9e6272dd204a2c2425a9bb2bf5 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 27 Feb 2024 17:45:01 +0000 Subject: [PATCH] autosign: new `xmr_setup` operation --- mmgen/main_autosign.py | 9 +++++++++ test/cmdtest_py_d/ct_xmr_autosign.py | 23 +++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/mmgen/main_autosign.py b/mmgen/main_autosign.py index 8764b5cc..a423851b 100755 --- a/mmgen/main_autosign.py +++ b/mmgen/main_autosign.py @@ -61,6 +61,9 @@ gen_key - generate the wallet encryption key and copy it to the removable device mounted at mountpoint ‘{asi.mountpoint}’ (as currently configured) setup - generate both wallet encryption key and temporary signing wallet +xmr_setup - set up temporary Monero signing wallets. This operation needn’t + be performed by the user directly in most cases, as Monero setup + is done by the ‘setup’ command when --xmrwallets is specified wait - start in loop mode: wait-mount-sign-unmount-wait @@ -188,6 +191,12 @@ if cmd: msg('') asi.xmr_setup() asi.do_umount() + elif cmd == 'xmr_setup': + if not cfg.xmrwallets: + die(1,'Please specify a wallet or range of wallets with the --xmrwallets option') + asi.do_mount() + asi.xmr_setup() + asi.do_umount() elif cmd == 'wait': main(do_loop=True) elif cmd == 'clean': diff --git a/test/cmdtest_py_d/ct_xmr_autosign.py b/test/cmdtest_py_d/ct_xmr_autosign.py index 6170d717..11b33600 100755 --- a/test/cmdtest_py_d/ct_xmr_autosign.py +++ b/test/cmdtest_py_d/ct_xmr_autosign.py @@ -58,6 +58,7 @@ class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignThreaded): ('dump_tmp_wallets', 'dumping Alice’s tmp wallets'), ('delete_tmp_wallets', 'deleting Alice’s tmp wallets'), ('autosign_setup', 'autosign setup with Alice’s seed'), + ('autosign_xmr_setup', 'autosign setup (creation of Monero signing wallets)'), ('create_watchonly_wallets', 'creating online (watch-only) wallets for Alice'), ('delete_tmp_dump_files', 'deleting Alice’s dump files'), ('gen_kafiles', 'generating key-address files for Miner'), @@ -207,25 +208,23 @@ class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignThreaded): return self.fund_alice(wallet=2) def autosign_setup(self): - - self.do_mount_online() - - self.asi_online.xmr_dir.mkdir(exist_ok=True) - (self.asi_online.xmr_dir / 'old.vkeys').touch() - - self.do_umount_online() - self.insert_device() - t = self.run_setup( mn_type = 'mmgen', mn_file = self.users['alice'].mmwords, use_dfl_wallet = None ) - t.expect('Continue with Monero setup? (Y/n): ','y') - t.written_to_file('View keys') - + t.expect('Continue with Monero setup? (Y/n): ','n') self.remove_device() + return t + def autosign_xmr_setup(self): + self.do_mount_online() + self.asi_online.xmr_dir.mkdir(exist_ok=True) + (self.asi_online.xmr_dir / 'old.vkeys').touch() + self.do_umount_online() + + t = self.spawn('mmgen-autosign', self.opts + ['xmr_setup'], no_passthru_opts=True) + t.written_to_file('View keys') return t def create_watchonly_wallets(self):