Browse Source

autosign: new `xmr_setup` operation

The MMGen Project 1 year ago
parent
commit
df7e8f0bca
2 changed files with 20 additions and 12 deletions
  1. 9 0
      mmgen/main_autosign.py
  2. 11 12
      test/cmdtest_py_d/ct_xmr_autosign.py

+ 9 - 0
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':

+ 11 - 12
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):