diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 8ea33ca3..6bb4f2b1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -2608,7 +2608,7 @@ public class AppController implements Initializable { public void cormorantScanStatus(CormorantScanStatusEvent event) { serverToggle.setDisable(true); if((AppServices.isConnecting() || AppServices.isConnected()) && !event.isCompleted()) { - statusUpdated(new StatusEvent("Scanning... (" + event.getProgress() + "% complete, " + event.getRemainingAsString() + " remaining)")); + statusUpdated(new StatusEvent("Scanning... (" + event.getProgress() + "% complete" + (event.getRemainingAsString().isEmpty() ? ")" : ", " + event.getRemainingAsString() + " remaining)"))); if(event.getProgress() > 0 && (statusTimeline == null || statusTimeline.getStatus() != Animation.Status.RUNNING)) { statusBar.setProgress((double)event.getProgress() / 100); } diff --git a/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java b/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java index 095c9afc..355284ec 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/cormorant/bitcoind/BitcoindClient.java @@ -292,12 +292,13 @@ public class BitcoindClient { scanningLock.lock(); try { scanningDescriptors.addAll(importingDescriptors.keySet()); + Platform.runLater(() -> EventManager.get().post(new CormorantScanStatusEvent("Scanning (0%)", getScanningWallets(), 0, null))); results = getBitcoindService().importDescriptors(importDescriptors); } finally { scanningLock.unlock(); Set scanningWallets = getScanningWallets(); - scanningDescriptors.clear(); Platform.runLater(() -> EventManager.get().post(new CormorantScanStatusEvent("Scanning completed", scanningWallets, 100, Duration.ZERO))); + scanningDescriptors.clear(); } for(int i = 0; i < importDescriptors.size(); i++) { @@ -535,7 +536,9 @@ public class BitcoindClient { Set scanningWallets = getScanningWallets(); int percent = walletInfo.scanning().getPercent(); Duration remainingDuration = walletInfo.scanning().getRemaining(); - Platform.runLater(() -> EventManager.get().post(new CormorantScanStatusEvent("Scanning" + (percent < 100 ? " (" + percent + "%)" : ""), scanningWallets, percent, remainingDuration))); + if(percent > 0) { + Platform.runLater(() -> EventManager.get().post(new CormorantScanStatusEvent("Scanning" + (percent < 100 ? " (" + percent + "%)" : ""), scanningWallets, percent, remainingDuration))); + } } } } catch(Exception e) { diff --git a/src/main/java/com/sparrowwallet/sparrow/terminal/SparrowTextGui.java b/src/main/java/com/sparrowwallet/sparrow/terminal/SparrowTextGui.java index 8e117f79..59b2514b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/terminal/SparrowTextGui.java +++ b/src/main/java/com/sparrowwallet/sparrow/terminal/SparrowTextGui.java @@ -187,7 +187,7 @@ public class SparrowTextGui extends MultiWindowTextGUI { @Subscribe public void cormorantScanStatusEvent(CormorantScanStatusEvent event) { - statusUpdated(new StatusEvent(event.isCompleted() ? "" : "Scanning... (" + event.getProgress() + "% complete, " + event.getRemainingAsString() + " remaining)")); + statusUpdated(new StatusEvent(event.isCompleted() ? "" : "Scanning... (" + event.getProgress() + "% complete" + (event.getRemainingAsString().isEmpty() ? ")" : ", " + event.getRemainingAsString() + " remaining)"))); } @Subscribe