From 0b28dcc228252053dd8199dc59189dcd45401bd4 Mon Sep 17 00:00:00 2001 From: direkturcrypto Date: Tue, 24 Feb 2026 16:38:28 +0700 Subject: [PATCH] fix(oneshot): always clear loss positions from redeem queue regardless of tx result --- src/oneshot/RedeemEngine.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/oneshot/RedeemEngine.js b/src/oneshot/RedeemEngine.js index 5a71c5e..78efae5 100644 --- a/src/oneshot/RedeemEngine.js +++ b/src/oneshot/RedeemEngine.js @@ -172,13 +172,14 @@ export class RedeemEngine { // Simulate: just log the outcome without touching the chain this._logSettlement(item, won, pnl, received, cost); } else { - // Real redemption: submit on-chain tx + // Always attempt redeemPositions — even for losses (burns the token, cleans wallet) const success = await this._executeRedeem(item); - if (!success) { - // tx failed — keep in queue, retry on next poll + if (!success && won) { + // Win but tx failed — USDC unclaimed, keep in queue and retry next poll logger.warn(`RedeemEngine: redemption tx failed for ${item.marketSlug} — will retry`); return; } + // Loss: clear from queue regardless of tx result — payout is 0, nothing to collect this._logSettlement(item, won, pnl, received, cost); }