From 69a1e67da2b2d0ccb658fb8c97d4768622ac92e9 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 20 Jun 2024 11:19:28 -0400 Subject: [PATCH] remove incomplete trades from trade summary to fix #1029 --- .../main/java/haveno/core/trade/ClosedTradableUtil.java | 8 ++++++++ core/src/main/java/haveno/core/trade/Trade.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/haveno/core/trade/ClosedTradableUtil.java b/core/src/main/java/haveno/core/trade/ClosedTradableUtil.java index 1df4dbd0..82c9a292 100644 --- a/core/src/main/java/haveno/core/trade/ClosedTradableUtil.java +++ b/core/src/main/java/haveno/core/trade/ClosedTradableUtil.java @@ -41,6 +41,14 @@ public class ClosedTradableUtil { public static Map getTotalVolumeByCurrency(List tradableList) { Map map = new HashMap<>(); tradableList.stream() + .filter(tradable -> { + if (tradable instanceof Trade) { + Trade trade = castToTrade(tradable); + return trade.isCompleted(); // TODO: does not consider if trade was reverted by arbitrator + } else { + return false; + } + }) .flatMap(tradable -> tradable.getOptionalVolume().stream()) .forEach(volume -> { String currencyCode = volume.getCurrencyCode(); diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index e6290cb5..6e774ad1 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -2180,7 +2180,7 @@ public abstract class Trade implements Tradable, Model { return tradeAmountTransferred(); } - private boolean tradeAmountTransferred() { + public boolean tradeAmountTransferred() { return isPaymentReceived() || (getDisputeResult() != null && getDisputeResult().getWinner() == DisputeResult.Winner.SELLER); }