From 008210abf6fabe7310e5031b3eb368d1575e254a Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 10 Jul 2022 18:07:20 -0400 Subject: [PATCH] fix reserved balance = frozen offer outputs + confirmed deposits --- core/src/main/java/bisq/core/btc/Balances.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/main/java/bisq/core/btc/Balances.java b/core/src/main/java/bisq/core/btc/Balances.java index e197c530..8e0457db 100644 --- a/core/src/main/java/bisq/core/btc/Balances.java +++ b/core/src/main/java/bisq/core/btc/Balances.java @@ -40,8 +40,10 @@ import javafx.collections.ListChangeListener; import javax.inject.Inject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import monero.common.MoneroError; import monero.wallet.model.MoneroOutputQuery; import monero.wallet.model.MoneroOutputWallet; +import monero.wallet.model.MoneroTxWallet; import org.bitcoinj.core.Coin; @Slf4j @@ -128,6 +130,12 @@ public class Balances { Coin sum = Coin.valueOf(0); List openTrades = tradeManager.getTradesStreamWithFundsLockedIn().collect(Collectors.toList()); for (Trade trade : openTrades) { + try { + MoneroTxWallet depositTx = xmrWalletService.getWallet().getTx(trade.getSelf().getDepositTxHash()); + if (!depositTx.isConfirmed()) continue; // outputs are frozen until confirmed by arbitrator's broadcast + } catch (MoneroError e) { + continue; + } if (trade.getContract() == null) continue; Long reservedAmt; OfferPayload offerPayload = trade.getContract().getOfferPayload();