Browse Source

check if wallet is mixing and restart whirlpool client if necessary

terminal
Craig Raw 3 years ago
parent
commit
ece786131e
  1. 2
      drongo
  2. 11
      src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java
  3. 7
      src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java

2
drongo

@ -1 +1 @@
Subproject commit 8e4924783224fc894b45855cdbd866981413db3b
Subproject commit 3a061cb73ae318fcbe7ea1dcb0b670e78803d9fa

11
src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java

@ -310,6 +310,17 @@ public class Whirlpool {
}
}
public void checkIfMixing() {
if(whirlpoolWalletService.whirlpoolWallet() == null) {
return;
}
if(isMixing() && !whirlpoolWalletService.whirlpoolWallet().isStarted()) {
log.warn("Wallet is not started, but mixingProperty is true");
WhirlpoolEventService.getInstance().post(new WalletStopEvent(whirlpoolWalletService.whirlpoolWallet()));
}
}
public boolean hasWallet() {
return hdWallet != null;
}

7
src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java

@ -182,6 +182,13 @@ public class WhirlpoolServices {
stopAllWhirlpool();
}
@Subscribe
public void newBlock(NewBlockEvent event) {
for(Whirlpool whirlpool : whirlpoolMap.values()) {
whirlpool.checkIfMixing();
}
}
@Subscribe
public void walletOpened(WalletOpenedEvent event) {
String walletId = event.getStorage().getWalletId(event.getWallet());

Loading…
Cancel
Save