From 9a2422d8f79e49b1e29aec1b0d68c31a1e37e2cf Mon Sep 17 00:00:00 2001 From: moralpriest Date: Thu, 9 Jul 2026 02:41:22 -0600 Subject: [PATCH] fix(walletapi): run SyncHistory in goroutine to avoid blocking sync loop SyncHistory performs a binary-search scan of the blockchain to find transactions affecting the wallet, making sequential RPC calls that can take minutes on restored wallets. When called synchronously inside Sync_Wallet_Memory_With_Daemon_internal, it blocks the sync loop and prevents daemon_height updates until completed. Running SyncHistory as a goroutine allows the sync loop to continue polling and updating heights while history is scanned in the background. --- walletapi/daemon_communication.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/walletapi/daemon_communication.go b/walletapi/daemon_communication.go index 2cffea05..a9eb7aab 100644 --- a/walletapi/daemon_communication.go +++ b/walletapi/daemon_communication.go @@ -288,7 +288,7 @@ func (w *Wallet_Memory) Sync_Wallet_Memory_With_Daemon_internal(scid crypto.Hash w.Lock() w.account.Balance[scid] = b w.Unlock() - w.SyncHistory(scid) // also update statement + go w.SyncHistory(scid) // also update statement (run in background to avoid blocking sync loop) } w.save_if_disk() // save wallet