Skip to content

Commit

Permalink
filter outbounds for not configured chains
Browse files Browse the repository at this point in the history
  • Loading branch information
mfornos committed Jan 16, 2025
1 parent e7b28d2 commit 5a4af74
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/server/src/services/agents/xcm/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export class XcmTracker {
}

const subs: RxSubscriptionWithId[] = []
const canBeMatched = ({ destination }: XcmSent) => chains.includes(destination.chainId)

try {
for (const chainId of chains) {
Expand All @@ -168,7 +169,11 @@ export class XcmTracker {
direction: 'out',
})
},
next: (msg: XcmSent) => this.#engine.onOutboundMessage(msg),
next: (msg: XcmSent) => {
if (canBeMatched(msg)) {
this.#engine.onOutboundMessage(msg)
}
},
}

if (this.#ingress.isRelay(chainId)) {
Expand Down Expand Up @@ -234,12 +239,10 @@ export class XcmTracker {
}
}
} catch (error) {
/* c8 ignore next */
// Clean up streams.
subs.forEach(({ sub }) => {
sub.unsubscribe()
})
/* c8 ignore next */
throw error
}

Expand Down

0 comments on commit 5a4af74

Please sign in to comment.