diff --git a/drongo b/drongo index 434c18ef..360550a7 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 434c18ef0a97d899b534bf81496207542ebbd395 +Subproject commit 360550a7183683ad4ee929a4c5411075bd751ffd diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java b/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java index e0e101b7..4d9cc8a1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java @@ -18,7 +18,7 @@ import org.controlsfx.glyphfont.Glyph; import org.controlsfx.tools.Platform; public class MixStatusCell extends TreeTableCell { - private static final int ERROR_DISPLAY_MINUTES = 5; + private static final int ERROR_DISPLAY_MILLIS = 5 * 60 * 1000; public MixStatusCell() { super(); @@ -69,7 +69,8 @@ public class MixStatusCell extends TreeTableCell { private void setMixFail(MixFailReason mixFailReason, String mixError, Long mixErrorTimestamp) { if(mixFailReason != MixFailReason.CANCEL) { - if(mixErrorTimestamp != null && System.currentTimeMillis() - mixErrorTimestamp > ERROR_DISPLAY_MINUTES * 60 * 1000) { + long elapsed = mixErrorTimestamp == null ? 0L : System.currentTimeMillis() - mixErrorTimestamp; + if(elapsed >= ERROR_DISPLAY_MILLIS) { //Old error, don't set again. return; } @@ -83,19 +84,13 @@ public class MixStatusCell extends TreeTableCell { "\nTo prevent sleeping, use the " + getPlatformSleepConfig() + " or enable the function in the Tools menu."); setTooltip(tt); - double fromValue = 1.0; - if(mixErrorTimestamp != null) { - fromValue -= (double)(System.currentTimeMillis() - mixErrorTimestamp) / (ERROR_DISPLAY_MINUTES * 60 * 1000); - } - - FadeTransition ft = new FadeTransition(Duration.minutes(ERROR_DISPLAY_MINUTES), failGlyph); - ft.setFromValue(Math.max(0, fromValue)); - ft.setToValue(0); + FadeTransition ft = new FadeTransition(Duration.millis(ERROR_DISPLAY_MILLIS - elapsed), failGlyph); + ft.setFromValue(1.0 - ((double)elapsed / ERROR_DISPLAY_MILLIS)); + ft.setToValue(0.0); ft.setOnFinished(event -> { setTooltip(null); }); ft.play(); - failGlyph.setUserData(mixFailReason); } else { setGraphic(null); setTooltip(null); diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java index fb824eb7..86a2aed6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java @@ -94,10 +94,6 @@ public class Whirlpool { this.tx0Service = new Tx0Service(config); WhirlpoolEventService.getInstance().register(this); - - StatusReporterService statusReporterService = new StatusReporterService(this); - statusReporterService.setPeriod(Duration.minutes(1)); - statusReporterService.start(); } private WhirlpoolWalletConfig computeWhirlpoolWalletConfig(HostAndPort torProxy) { @@ -744,30 +740,6 @@ public class Whirlpool { } } - private static class StatusReporterService extends ScheduledService { - private final Whirlpool whirlpool; - - public StatusReporterService(Whirlpool whirlpool) { - this.whirlpool = whirlpool; - } - - @Override - protected Task createTask() { - return new Task<>() { - protected Boolean call() throws Exception { - if(whirlpool.mixingProperty().get()) { - WhirlpoolWallet whirlpoolWallet = whirlpool.getWhirlpoolWallet(); - log.debug(whirlpool.walletId + ": " + whirlpoolWallet.getMixingState()); - } else { - log.debug(whirlpool.walletId + ": Not mixing"); - } - - return true; - } - }; - } - } - public static class WalletUtxo { public final Wallet wallet; public final BlockTransactionHashIndex utxo; diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java index b1ac71a4..c0c25a99 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java @@ -99,7 +99,6 @@ public class WhirlpoolServices { startupService.cancel(); }); startupService.setOnFailed(workerStateEvent -> { - log.error("Failed to start whirlpool", workerStateEvent.getSource().getException()); Throwable exception = workerStateEvent.getSource().getException(); while(exception.getCause() != null) { exception = exception.getCause(); @@ -109,6 +108,9 @@ public class WhirlpoolServices { if(torProxy != null) { whirlpool.refreshTorCircuits(); } + log.error("Error connecting to Whirlpool server: " + exception.getMessage()); + } else { + log.error("Failed to start Whirlpool", workerStateEvent.getSource().getException()); } }); startupService.start();