mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
tradeManager error handling uses getOpenTradeByUid()
This commit is contained in:
parent
1d17330487
commit
567ef6784d
@ -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<Trade> getOpenTradeByUid(String tradeUid) {
|
||||
synchronized (tradableList) {
|
||||
return tradableList.stream().filter(e -> e.getUid().equals(tradeUid)).findFirst();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Trade> getAllTrades() {
|
||||
List<Trade> trades = new ArrayList<Trade>();
|
||||
trades.addAll(tradableList.getList());
|
||||
|
Loading…
Reference in New Issue
Block a user