diff --git a/core/src/main/java/haveno/core/trade/TradeManager.java b/core/src/main/java/haveno/core/trade/TradeManager.java index e5072d53e0..8a3a10be59 100644 --- a/core/src/main/java/haveno/core/trade/TradeManager.java +++ b/core/src/main/java/haveno/core/trade/TradeManager.java @@ -414,7 +414,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi initPersistedTrade(trade); // remove trade if protocol didn't initialize - if (getOpenTrade(trade.getId()).isPresent() && !trade.isDepositRequested()) { + if (getOpenTradeByUid(trade.getId()).isPresent() && !trade.isDepositRequested()) { log.warn("Removing persisted {} {} with uid={} because it did not finish initializing (state={})", trade.getClass().getSimpleName(), trade.getId(), trade.getUid(), trade.getState()); maybeRemoveTradeOnError(trade); } @@ -1137,6 +1137,12 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi } } + public Optional getOpenTradeByUid(String tradeUid) { + synchronized (tradableList) { + return tradableList.stream().filter(e -> e.getUid().equals(tradeUid)).findFirst(); + } + } + public List getAllTrades() { List trades = new ArrayList(); trades.addAll(tradableList.getList());