do not initialize failed trades until moved back to pending trades

This commit is contained in:
woodser 2024-11-07 10:44:08 -05:00
parent cdb99a9cfb
commit 1af87b2db9
2 changed files with 13 additions and 2 deletions

View file

@ -450,6 +450,13 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
return;
}
// skip if marked as failed
if (failedTradesManager.getObservableList().contains(trade)) {
log.warn("Skipping initialization of failed trade {} {}", trade.getClass().getSimpleName(), trade.getId());
tradesToSkip.add(trade);
return;
}
// initialize trade
initPersistedTrade(trade);
@ -1060,7 +1067,11 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
private void addTradeToPendingTrades(Trade trade) {
if (!trade.isInitialized()) {
initPersistedTrade(trade);
try {
initPersistedTrade(trade);
} catch (Exception e) {
log.warn("Error initializing {} {} on move to pending trades", trade.getClass().getSimpleName(), trade.getShortId(), e);
}
}
addTrade(trade);
}

View file

@ -404,7 +404,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
}
if (trade.getTakerDepositTx() == null) {
return Res.get("portfolio.pending.failedTrade.missingDepositTx"); // TODO (woodser): use .missingTakerDepositTx, .missingMakerDepositTx
return Res.get("portfolio.pending.failedTrade.missingDepositTx"); // TODO (woodser): use .missingTakerDepositTx, .missingMakerDepositTx, update translation to 2-of-3 multisig
}
if (trade.hasErrorMessage()) {