Browse Source

mmgen-xmrwallet: add `--rescan-spent` option

The MMGen Project 8 months ago
parent
commit
42a5821e98

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-14.1.dev34
+14.1.dev35

+ 8 - 2
mmgen/help/xmrwallet.py

@@ -368,9 +368,9 @@ the outputs into the corresponding signing wallet(s) (and optionally redo any
 failed transaction signing operation).
 
 Following a ‘resubmit’, use the ‘export-outputs-sign’ operation instead, and
-add the --rescan-blockchain option:
+add the --rescan-spent option:
 
-$ mmgen-xmrwallet --autosign --rescan-blockchain export-outputs-sign <wallet index>
+$ mmgen-xmrwallet --autosign --rescan-spent export-outputs-sign <wallet index>
 
 Here the offline signing wallet(s) will also create signed key images. Insert
 the removable device on your online machine and import the signed key images
@@ -378,6 +378,12 @@ into your online wallet as follows:
 
 $ mmgen-xmrwallet --autosign import-key-images
 
+Usually, this is all that is required.  However, if your wallet continues to
+show an incorrect balance after the import operation, you’ll need to re-run
+‘export-outputs-sign’ with the --rescan-blockchain option, followed by another
+offline signing and online key image import.  Note that blockchain rescans can
+take a long time, so patience is required here.
+
 
            Replacing Existing Hot Wallets with Watch-Only Wallets
 

+ 2 - 0
mmgen/main_xmrwallet.py

@@ -80,6 +80,8 @@ opts_data = {
 -k, --use-internal-keccak-module Force use of the internal keccak module
 -p, --hash-preset=P              Use scrypt hash preset 'P' for password
                                  hashing (default: '{gc.dfl_hash_preset}')
+-P, --rescan-spent               Perform a rescan of spent outputs.  Used only
+                                 with the ‘export-outputs-sign’ operation
 -R, --tx-relay-daemon=H:P[:H:P]  Relay transactions via a monerod specified by
                                  {R}
 -r, --restore-height=H           Scan from height 'H' when creating wallets.

+ 6 - 1
mmgen/xmrwallet.py

@@ -2023,7 +2023,6 @@ class MoneroWalletOps:
 	class export_outputs(wallet):
 		action = 'exporting outputs from'
 		stem = 'process'
-		opts = ('rescan_blockchain',)
 		sign = False
 
 		async def process_wallet(self,d,fn,last):
@@ -2035,6 +2034,11 @@ class MoneroWalletOps:
 				self.c.call('rescan_blockchain')
 				gmsg('done')
 
+			if self.cfg.rescan_spent:
+				gmsg_r('\n  Rescanning spent outputs...')
+				self.c.call('rescan_spent')
+				gmsg('done')
+
 			self.head_msg(d.idx,h.fn)
 			for ftype in ('Unsigned','Signed'):
 				old_fn = getattr(MoneroWalletOutputsFile,ftype).find_fn_from_wallet_fn(
@@ -2053,6 +2057,7 @@ class MoneroWalletOps:
 			return True
 
 	class export_outputs_sign(export_outputs):
+		opts = ('rescan_spent','rescan_blockchain')
 		sign = True
 
 	class import_outputs(wallet):

+ 1 - 1
test/cmdtest_py_d/ct_xmr_autosign.py

@@ -373,7 +373,7 @@ class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignThreaded):
 	def export_outputs1(self):
 		return self._export_outputs('1', op='export-outputs')
 
-	def export_outputs2(self):
+	def export_outputs2(self): # NB: --rescan-spent does not work with testnet/stagenet
 		return self._export_outputs('1', op='export-outputs-sign', add_opts=['--rescan-blockchain'])
 
 	def export_outputs3(self):