Skip to content

Commit

Permalink
feature: Added adjustments to support on-demand blocks (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
omritoptix authored Nov 14, 2023
1 parent 9e36d43 commit 8b8e582
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion relayer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func MsgUpdateClient(
eg.Go(func() error {
return retry.Do(func() error {
var err error
dstTrustedHeader, err = src.ChainProvider.QueryIBCHeader(egCtx, int64(dstClientState.GetLatestHeight().GetRevisionHeight())+1)
dstTrustedHeader, err = src.ChainProvider.QueryIBCHeader(egCtx, int64(dstClientState.GetLatestHeight().GetRevisionHeight()))
return err
}, retry.Context(egCtx), RtyAtt, RtyDel, RtyErr, retry.OnRetry(func(n uint, err error) {
src.log.Info(
Expand Down
5 changes: 5 additions & 0 deletions relayer/processor/message_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ func (mp *messageProcessor) assembleMsgUpdateClient(ctx context.Context, src, ds
trustedNextValidatorsHash = header.NextValidatorsHash()
}

// As we only require one chain to be in sync the src.latestHeader may be nil. In that case
// we want to skip it
if src.latestHeader == nil {
return fmt.Errorf("latest header is nil for chain_id: %s. Waiting for catching up", src.info.ChainID)
}
if src.latestHeader.Height() == trustedConsensusHeight.RevisionHeight &&
!bytes.Equal(src.latestHeader.NextValidatorsHash(), trustedNextValidatorsHash) {
return fmt.Errorf("latest header height is equal to the client trusted height: %d, "+
Expand Down
2 changes: 1 addition & 1 deletion relayer/processor/path_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (pp *PathProcessor) Run(ctx context.Context, cancel func()) {
}
}

if !pp.pathEnd1.inSync || !pp.pathEnd2.inSync {
if !pp.pathEnd1.inSync && !pp.pathEnd2.inSync {
continue
}

Expand Down

0 comments on commit 8b8e582

Please sign in to comment.