mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
cormorant: send first scan event immediately
This commit is contained in:
parent
5ca60699ef
commit
66dc394215
3 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Wallet> 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<Wallet> 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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue