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

View file

@ -162,12 +162,16 @@ public class XmrWalletService {
public MoneroWallet getWallet() { public MoneroWallet getWallet() {
State state = walletsSetup.getWalletConfig().state(); 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; return wallet;
} }
public boolean isWalletReady() { public boolean isWalletReady() {
return getWallet() != null; try {
return getWallet() != null;
} catch (Exception e) {
return false;
}
} }
public boolean isWalletEncrypted() { public boolean isWalletEncrypted() {