From 8fe4a0bc982df7c4a605d9b0a4b638118d1573e6 Mon Sep 17 00:00:00 2001 From: Step7750 Date: Mon, 4 May 2026 16:10:56 -0600 Subject: [PATCH 1/2] fix: Increase Strictness of Rollback Check Now that items don't receive a trade cooldown on reversal, their asset ID doesn't change either. This change scopes the check to also ensure that the buyer/seller pair is aligned as well. Ref CSF-1401 --- src/lib/alarms/rollback.ts | 5 ++++- src/lib/alarms/trade_history.ts | 2 ++ src/lib/bridge/handlers/trade_history_status.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/alarms/rollback.ts b/src/lib/alarms/rollback.ts index aab38f67..f3919a59 100644 --- a/src/lib/alarms/rollback.ts +++ b/src/lib/alarms/rollback.ts @@ -30,7 +30,10 @@ function findRollbackTrades(pendingTrades: SlimTrade[], tradeHistory: TradeHisto // Does it correspond to an active CSFloat sale? const csfloatTrade = pendingTrades.find( - (e) => e.state === TradeState.PENDING && all_ids.includes(e.contract.item.asset_id) + (e) => + e.state === TradeState.PENDING && + all_ids.includes(e.contract.item.asset_id) && + (trade.other_party_id === e.seller_id || trade.other_party_id === e.buyer_id) ); if (!csfloatTrade) { continue; diff --git a/src/lib/alarms/trade_history.ts b/src/lib/alarms/trade_history.ts index 563a5842..0e7c9ac7 100644 --- a/src/lib/alarms/trade_history.ts +++ b/src/lib/alarms/trade_history.ts @@ -147,6 +147,7 @@ export async function getTradeHistoryFromAPI( .map((e) => { return { other_party_url: `https://steamcommunity.com/profiles/${e.steamid_other}`, + other_party_id: e.steamid_other, received_assets: (e.assets_received || []) .filter((e) => e.appid === AppId.CSGO) .map((e) => { @@ -193,6 +194,7 @@ function parseTradeHistoryHTML(body: string): TradeHistoryStatus[] { const statuses = [...links].map((e) => { return { other_party_url: `https://steamcommunity.com/${e[1]}`, + other_party_id: '', received_assets: [], given_assets: [], trade_id: '', diff --git a/src/lib/bridge/handlers/trade_history_status.ts b/src/lib/bridge/handlers/trade_history_status.ts index daa4396d..ba7fa493 100644 --- a/src/lib/bridge/handlers/trade_history_status.ts +++ b/src/lib/bridge/handlers/trade_history_status.ts @@ -11,6 +11,7 @@ export interface TradeHistoryStatus { trade_id: string; status: number; other_party_url: string; + other_party_id: string; received_assets: TradeHistoryAsset[]; given_assets: TradeHistoryAsset[]; time_init: number; From 855a7b2035324d458ca0591a067d5b5761c1ab28 Mon Sep 17 00:00:00 2001 From: Step7750 Date: Mon, 4 May 2026 16:15:30 -0600 Subject: [PATCH 2/2] adds ping cancel trades scope --- src/lib/alarms/trade_offer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/alarms/trade_offer.ts b/src/lib/alarms/trade_offer.ts index b51b10d6..f9bfe0e1 100644 --- a/src/lib/alarms/trade_offer.ts +++ b/src/lib/alarms/trade_offer.ts @@ -112,7 +112,8 @@ export async function pingCancelTrades(pendingTrades: SlimTrade[], tradeHistory: const rolledBackTrade = (tradeHistory || []).find( (e) => e.status === TradeStatus.TradeProtectionRollback && - !!e.received_assets.find((a) => a.asset_id === trade.contract?.item?.asset_id) + !!e.received_assets.find((a) => a.asset_id === trade.contract?.item?.asset_id) && + (e.other_party_id === trade.seller_id || e.other_party_id === trade.buyer_id) ); if (!rolledBackTrade) { // no rollback, trade offer was accepted, shouldn't cancel