Skip to content

Commit

Permalink
fix: filter packetHeights before
Browse files Browse the repository at this point in the history
  • Loading branch information
viveksharmapoudel committed Sep 11, 2023
1 parent 53729e4 commit 64cf31d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions relayer/processor/path_processor_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,12 @@ func (pp *PathProcessor) queuePendingRecvAndAcksByHeights(
skipped := false

for i, seq := range unrecv {
// seq could be only queried if in packetheights
seqHeight, ok := packetHeights.PacketHeights[seq]
if !ok {
continue

Check warning on line 1795 in relayer/processor/path_processor_internal.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_processor_internal.go#L1787-L1795

Added lines #L1787 - L1795 were not covered by tests
}

srcMu.Lock()
if srcCache.IsCached(chantypes.EventTypeSendPacket, k, seq) {
continue // already cached

Check warning on line 1800 in relayer/processor/path_processor_internal.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_processor_internal.go#L1798-L1800

Added lines #L1798 - L1800 were not covered by tests
Expand All @@ -1800,16 +1806,10 @@ func (pp *PathProcessor) queuePendingRecvAndAcksByHeights(
break

Check warning on line 1806 in relayer/processor/path_processor_internal.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_processor_internal.go#L1802-L1806

Added lines #L1802 - L1806 were not covered by tests
}

// incase of BTPBlock SeqHeight+1 will have matching BTPMessage
seqHeight, ok := packetHeights.PacketHeights[seq]
if !ok {
continue
}

src.log.Debug("Querying send packet",
zap.String("channel", k.ChannelID),
zap.String("port", k.PortID),
zap.Uint64("sequence", seq),
zap.Any("Seq", seq),
)

seq := seq
Expand Down Expand Up @@ -1844,7 +1844,7 @@ func (pp *PathProcessor) queuePendingRecvAndAcksByHeights(
src.log.Debug("Will flush MsgRecvPacket",
zap.String("channel", k.ChannelID),
zap.String("port", k.PortID),
zap.Uint64s("sequences", unrecv),
zap.Any("PacketHeights", packetHeights),
)
} else {
src.log.Debug("No MsgRecvPacket to flush",
Expand Down

0 comments on commit 64cf31d

Please sign in to comment.