only update balances if not terminated

This commit is contained in:
woodser 2022-11-27 14:03:44 +00:00
parent a408b0e7ae
commit a2929035bc
2 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,6 @@
package bisq.core.btc;
import bisq.common.UserThread;
import bisq.core.btc.listeners.XmrBalanceListener;
import bisq.core.btc.wallet.XmrWalletService;
import bisq.core.offer.OfferPayload;
@ -51,8 +50,6 @@ public class Balances {
private final TradeManager tradeManager;
private final XmrWalletService xmrWalletService;
private final OpenOfferManager openOfferManager;
private final ClosedTradableManager closedTradableManager;
private final FailedTradesManager failedTradesManager;
private final RefundManager refundManager;
@Getter
@ -76,8 +73,6 @@ public class Balances {
this.tradeManager = tradeManager;
this.xmrWalletService = xmrWalletService;
this.openOfferManager = openOfferManager;
this.closedTradableManager = closedTradableManager;
this.failedTradesManager = failedTradesManager;
this.refundManager = refundManager;
}
@ -95,6 +90,7 @@ public class Balances {
}
private void updatedBalances() {
if (!xmrWalletService.isWalletReady()) return;
updateAvailableBalance();
updatePendingBalance();
updateReservedOfferBalance();

View file

@ -162,12 +162,16 @@ public class XmrWalletService {
public MoneroWallet getWallet() {
State state = walletsSetup.getWalletConfig().state();
checkState(state == State.STARTING || state == State.RUNNING, "Cannot call until startup is complete, but state is: " + state);
checkState(state == State.STARTING || state == State.RUNNING, "Cannot call until startup is complete and running, but state is: " + state);
return wallet;
}
public boolean isWalletReady() {
try {
return getWallet() != null;
} catch (Exception e) {
return false;
}
}
public boolean isWalletEncrypted() {