From 25ce077484da1914f5d413e2e1291220acf61fb9 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Tue, 31 Mar 2026 09:43:38 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20wallet=20restore=20height=20=E2=80=94=20?= =?UTF-8?q?look=20back=20~2=20days=20instead=20of=20current=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When generate_from_keys creates a new wallet file (first open on a wallet-rpc instance, or after cache loss), restore_height was set to the current daemon height. This means the wallet only scans from NOW, missing any payments sent before the wallet was opened. A 1440-block lookback (~2 days at ~2 min/block) ensures recent payments are found after container restarts or wallet cache loss. --- api/app/monero_service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/app/monero_service.py b/api/app/monero_service.py index 78efb83..a2e7c1a 100644 --- a/api/app/monero_service.py +++ b/api/app/monero_service.py @@ -393,7 +393,10 @@ class MoneroWalletService: ) except (RPCError, RequestException): try: - restore_height = self._daemon_height() or 0 + # Look back ~2 days (1440 blocks at ~2 min/block) so new wallet + # files can find payments that arrived before the wallet was opened. + daemon_height = self._daemon_height() or 0 + restore_height = max(0, daemon_height - 1440) gen_start = time.monotonic() # generate_from_keys opens the wallet when successful. backend.client.raw_request(