From 048dfa49932eca0d40cce8aa75fbebc3aae7fd3f Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Mon, 27 Mar 2023 10:22:14 -0600 Subject: [PATCH] Pre-filter flush channels (#1146) --- relayer/processor/path_processor_internal.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/relayer/processor/path_processor_internal.go b/relayer/processor/path_processor_internal.go index 9fc835257..9ee4c2a72 100644 --- a/relayer/processor/path_processor_internal.go +++ b/relayer/processor/path_processor_internal.go @@ -1045,12 +1045,26 @@ func (pp *PathProcessor) flush(ctx context.Context) { if !open { continue } + if !pp.pathEnd1.info.ShouldRelayChannel(ChainChannelKey{ + ChainID: pp.pathEnd1.info.ChainID, + CounterpartyChainID: pp.pathEnd2.info.ChainID, + ChannelKey: k, + }) { + continue + } eg.Go(queryPacketCommitments(ctx, pp.pathEnd1, k, commitments1, &commitments1Mu)) } for k, open := range pp.pathEnd2.channelStateCache { if !open { continue } + if !pp.pathEnd2.info.ShouldRelayChannel(ChainChannelKey{ + ChainID: pp.pathEnd2.info.ChainID, + CounterpartyChainID: pp.pathEnd1.info.ChainID, + ChannelKey: k, + }) { + continue + } eg.Go(queryPacketCommitments(ctx, pp.pathEnd2, k, commitments2, &commitments2Mu)) }