From fd328ceeea191709f3bf57cd0887bdd61d3ea670 Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 7 Apr 2024 12:40:03 -0400 Subject: [PATCH] update sync progress in realtime with native wallet --- .../haveno/core/xmr/wallet/XmrWalletService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java index 7ded1e7d..b83fdf53 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -963,6 +963,20 @@ public class XmrWalletService { } private void syncWalletWithProgress() { + + // update sync progress in realtime with native wallet + if (wallet instanceof MoneroWalletFull) { + wallet.sync(new MoneroWalletListener() { + @Override + public void onSyncProgress(long height, long startHeight, long endHeight, double percentDone, String message) { + updateSyncProgress(); + } + }); + wasWalletSynced = true; + return; + } + + // poll wallet for progress updateSyncProgress(); wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs()); CountDownLatch latch = new CountDownLatch(1); @@ -1547,6 +1561,7 @@ public class XmrWalletService { @Override public void onSyncProgress(long height, long startHeight, long endHeight, double percentDone, String message) { + ThreadUtils.submitToPool(() -> updateSyncProgress()); for (MoneroWalletListenerI listener : walletListeners) ThreadUtils.submitToPool(() -> listener.onSyncProgress(height, startHeight, endHeight, percentDone, message)); }