From 76e1de38e8118f6af4b30ab399991282a693cadb Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sat, 5 Jun 2021 12:31:49 +0100 Subject: [PATCH] Workaround for issue where sometimes an AT stays in "TRADING" mode even after it is marked as finished. This caused Bob's tradebot to enter BOB_REFUNDED mode instead of redeeming the LTC. This workaround treats "TRADING" as "REDEEMED" as long as the AT is finished. It will still enter the BOB_REFUNDED state if the AT's trade state is "REFUNDED" or "CANCELLED", to prevent it trying to redeem LTC without the secret. Longer term we need to prevent the AT itself from getting in this state to begin with, but this should at least solve the LTC redemption problem that occurs as a result. --- .../qortal/controller/tradebot/LitecoinACCTv1TradeBot.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/qortal/controller/tradebot/LitecoinACCTv1TradeBot.java b/src/main/java/org/qortal/controller/tradebot/LitecoinACCTv1TradeBot.java index 3d8d5054..0bd2972b 100644 --- a/src/main/java/org/qortal/controller/tradebot/LitecoinACCTv1TradeBot.java +++ b/src/main/java/org/qortal/controller/tradebot/LitecoinACCTv1TradeBot.java @@ -716,9 +716,9 @@ public class LitecoinACCTv1TradeBot implements AcctTradeBot { // Not finished yet return; - // If AT is not REDEEMED then something has gone wrong - if (crossChainTradeData.mode != AcctMode.REDEEMED) { - // Not redeemed so must be refunded/cancelled + // If AT is REFUNDED or CANCELLED then something has gone wrong + if (crossChainTradeData.mode == AcctMode.REFUNDED || crossChainTradeData.mode == AcctMode.CANCELLED) { + // Alice hasn't redeemed the QORT, so there is no point in trying to redeem the LTC TradeBot.updateTradeBotState(repository, tradeBotData, State.BOB_REFUNDED, () -> String.format("AT %s has auto-refunded - trade aborted", tradeBotData.getAtAddress()));