From 42a5821e98751e59147ab9a761c0b858fb999700 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 30 Jun 2024 14:02:07 +0000 Subject: [PATCH] mmgen-xmrwallet: add `--rescan-spent` option --- mmgen/data/version | 2 +- mmgen/help/xmrwallet.py | 10 ++++++++-- mmgen/main_xmrwallet.py | 2 ++ mmgen/xmrwallet.py | 7 ++++++- test/cmdtest_py_d/ct_xmr_autosign.py | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mmgen/data/version b/mmgen/data/version index adec06e4..2c1ac708 100644 --- a/mmgen/data/version +++ b/mmgen/data/version @@ -1 +1 @@ -14.1.dev34 +14.1.dev35 diff --git a/mmgen/help/xmrwallet.py b/mmgen/help/xmrwallet.py index 3cc19f85..5756e8b3 100755 --- a/mmgen/help/xmrwallet.py +++ b/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 +$ mmgen-xmrwallet --autosign --rescan-spent export-outputs-sign 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 diff --git a/mmgen/main_xmrwallet.py b/mmgen/main_xmrwallet.py index 3a87c99c..daa9b38e 100755 --- a/mmgen/main_xmrwallet.py +++ b/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. diff --git a/mmgen/xmrwallet.py b/mmgen/xmrwallet.py index fbefc357..0f222c21 100755 --- a/mmgen/xmrwallet.py +++ b/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): diff --git a/test/cmdtest_py_d/ct_xmr_autosign.py b/test/cmdtest_py_d/ct_xmr_autosign.py index 620b934b..5a03dfe2 100755 --- a/test/cmdtest_py_d/ct_xmr_autosign.py +++ b/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):