check if wallet is mixing and restart whirlpool client if necessary

This commit is contained in:
Craig Raw
2021-11-17 16:02:11 +02:00
parent dc65313313
commit ece786131e
3 changed files with 19 additions and 1 deletions
@@ -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;
}
@@ -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());