mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
check if wallet is mixing and restart whirlpool client if necessary
This commit is contained in:
parent
dc65313313
commit
ece786131e
3 changed files with 19 additions and 1 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 8e4924783224fc894b45855cdbd866981413db3b
|
Subproject commit 3a061cb73ae318fcbe7ea1dcb0b670e78803d9fa
|
|
@ -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() {
|
public boolean hasWallet() {
|
||||||
return hdWallet != null;
|
return hdWallet != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,13 @@ public class WhirlpoolServices {
|
||||||
stopAllWhirlpool();
|
stopAllWhirlpool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void newBlock(NewBlockEvent event) {
|
||||||
|
for(Whirlpool whirlpool : whirlpoolMap.values()) {
|
||||||
|
whirlpool.checkIfMixing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void walletOpened(WalletOpenedEvent event) {
|
public void walletOpened(WalletOpenedEvent event) {
|
||||||
String walletId = event.getStorage().getWalletId(event.getWallet());
|
String walletId = event.getStorage().getWalletId(event.getWallet());
|
||||||
|
|
Loading…
Reference in a new issue