From 1cbf14f477131d311caeca40ce721f14cf0c0a17 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 28 Oct 2023 15:45:07 -0400 Subject: [PATCH] fix trade wallet balance in take offer view --- .../desktop/main/offer/OfferDataModel.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/OfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/OfferDataModel.java index f41bab09db..ea507ee59a 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/OfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/OfferDataModel.java @@ -66,11 +66,6 @@ public abstract class OfferDataModel extends ActivatableDataModel { protected void updateBalance() { updateBalances(); - if (useSavingsWallet) { - if (totalToPay.get() != null) { - balance.set(totalToPay.get().min(totalBalance)); - } - } missingCoin.set(offerUtil.getBalanceShortage(totalToPay.get(), balance.get())); isXmrWalletFunded.set(offerUtil.isBalanceSufficient(totalToPay.get(), balance.get())); if (totalToPay.get() != null && isXmrWalletFunded.get() && !showWalletFundedNotification.get()) { @@ -80,11 +75,6 @@ public abstract class OfferDataModel extends ActivatableDataModel { protected void updateAvailableBalance() { updateBalances(); - if (useSavingsWallet) { - if (totalToPay.get() != null) { - availableBalance.set(totalToPay.get().min(totalAvailableBalance)); - } - } missingCoin.set(offerUtil.getBalanceShortage(totalToPay.get(), availableBalance.get())); isXmrWalletFunded.set(offerUtil.isBalanceSufficient(totalToPay.get(), availableBalance.get())); if (totalToPay.get() != null && isXmrWalletFunded.get() && !showWalletFundedNotification.get()) { @@ -96,8 +86,12 @@ public abstract class OfferDataModel extends ActivatableDataModel { BigInteger tradeWalletBalance = xmrWalletService.getBalanceForSubaddress(addressEntry.getSubaddressIndex()); BigInteger tradeWalletAvailableBalance = xmrWalletService.getAvailableBalanceForSubaddress(addressEntry.getSubaddressIndex()); if (useSavingsWallet) { - totalBalance = xmrWalletService.getBalance();; + totalBalance = xmrWalletService.getBalance(); totalAvailableBalance = xmrWalletService.getAvailableBalance(); + if (totalToPay.get() != null) { + balance.set(totalToPay.get().min(totalBalance)); + availableBalance.set(totalToPay.get().min(totalAvailableBalance)); + } } else { balance.set(tradeWalletBalance); availableBalance.set(tradeWalletAvailableBalance);