Skip to content

Commit 8fe4a0b

Browse files
committed
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
1 parent 560f4cc commit 8fe4a0b

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/lib/alarms/rollback.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ function findRollbackTrades(pendingTrades: SlimTrade[], tradeHistory: TradeHisto
3030

3131
// Does it correspond to an active CSFloat sale?
3232
const csfloatTrade = pendingTrades.find(
33-
(e) => e.state === TradeState.PENDING && all_ids.includes(e.contract.item.asset_id)
33+
(e) =>
34+
e.state === TradeState.PENDING &&
35+
all_ids.includes(e.contract.item.asset_id) &&
36+
(trade.other_party_id === e.seller_id || trade.other_party_id === e.buyer_id)
3437
);
3538
if (!csfloatTrade) {
3639
continue;

src/lib/alarms/trade_history.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export async function getTradeHistoryFromAPI(
147147
.map((e) => {
148148
return {
149149
other_party_url: `https://steamcommunity.com/profiles/${e.steamid_other}`,
150+
other_party_id: e.steamid_other,
150151
received_assets: (e.assets_received || [])
151152
.filter((e) => e.appid === AppId.CSGO)
152153
.map((e) => {
@@ -193,6 +194,7 @@ function parseTradeHistoryHTML(body: string): TradeHistoryStatus[] {
193194
const statuses = [...links].map((e) => {
194195
return {
195196
other_party_url: `https://steamcommunity.com/${e[1]}`,
197+
other_party_id: '',
196198
received_assets: [],
197199
given_assets: [],
198200
trade_id: '',

src/lib/bridge/handlers/trade_history_status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface TradeHistoryStatus {
1111
trade_id: string;
1212
status: number;
1313
other_party_url: string;
14+
other_party_id: string;
1415
received_assets: TradeHistoryAsset[];
1516
given_assets: TradeHistoryAsset[];
1617
time_init: number;

0 commit comments

Comments
 (0)