Skip to content

Commit

Permalink
Merge pull request #34 from datachainlab/v0.2.10.1
Browse files Browse the repository at this point in the history
Forward-port patch #31 #33

Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
  • Loading branch information
bluele authored Jan 26, 2024
2 parents 0af1ce9 + a52d540 commit abacd46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/relay/ethereum/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ func (c *Chain) QueryUnfinalizedRelayPackets(ctx core.QueryContext, counterparty
return nil, err
}

if checkpoint > ctx.Height().GetRevisionHeight() {
logger.Info("`send` checkpoint is greater than target height", "checkpoint", checkpoint, "height", ctx.Height().GetRevisionHeight())
return core.PacketInfoList{}, nil
}
packets, err := c.findSentPackets(ctx, checkpoint)
if err != nil {
logger.Error("failed to find sent packets", err)
Expand Down Expand Up @@ -383,6 +387,10 @@ func (c *Chain) QueryUnfinalizedRelayAcknowledgements(ctx core.QueryContext, cou
return nil, err
}

if checkpoint > ctx.Height().GetRevisionHeight() {
logger.Info("`recv` checkpoint is greater than target height", "checkpoint", checkpoint, "height", ctx.Height().GetRevisionHeight())
return core.PacketInfoList{}, nil
}
packets, err := c.findReceivedPackets(ctx, checkpoint)
if err != nil {
logger.Error("failed to find received packets", err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/relay/ethereum/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func init() {
func (chain *Chain) findSentPackets(ctx core.QueryContext, fromHeight uint64) (core.PacketInfoList, error) {
logger := chain.GetChannelLogger()
now := time.Now()

var dstPortID, dstChannelID string
if channel, found, err := chain.ibcHandler.GetChannel(
chain.callOptsFromQueryContext(ctx),
Expand Down Expand Up @@ -111,6 +112,7 @@ func (chain *Chain) findSentPackets(ctx core.QueryContext, fromHeight uint64) (c
func (chain *Chain) findReceivedPackets(ctx core.QueryContext, fromHeight uint64) (core.PacketInfoList, error) {
logger := chain.GetChannelLogger()
now := time.Now()

recvPacketEvents, err := chain.findRecvPacketEvents(ctx, fromHeight)
if err != nil {
logger.Error("failed to find recv packet events", err)
Expand Down

0 comments on commit abacd46

Please sign in to comment.