Skip to content

Commit

Permalink
Ensure that ✘ is displayed for clients if they are expired (#1352)
Browse files Browse the repository at this point in the history
* Ensure that ✘ is displayed for clients if they are expired

* Address review comment
  • Loading branch information
vimystic committed Dec 5, 2023
1 parent c6e5bdb commit 1c18c2b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions relayer/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package relayer
import (
"context"
"fmt"
"strings"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
Expand All @@ -12,8 +13,9 @@ import (
)

const (
check = "✔"
xIcon = "✘"
check = "✔"
xIcon = "✘"
Expired = "EXPIRED"
)

// Paths represent connection paths between chains
Expand Down Expand Up @@ -249,6 +251,23 @@ func (p *Path) QueryPathStatus(ctx context.Context, src, dst *Chain) *PathWithSt
if err := eg.Wait(); err != nil || srcCs == nil || dstCs == nil {
return out
}

srcExpiration, srcClientInfo, errSrc := QueryClientExpiration(ctx, src, dst)
if errSrc != nil {
return out
}

dstExpiration, dstClientInfo, errDst := QueryClientExpiration(ctx, dst, src)
if errDst != nil {
return out
}

srcData := SPrintClientExpiration(src, srcExpiration, srcClientInfo)
dstData := SPrintClientExpiration(dst, dstExpiration, dstClientInfo)

if strings.Contains(srcData, Expired) || strings.Contains(dstData, Expired) {
return out
}
out.Status.Clients = true

eg, egCtx = errgroup.WithContext(ctx)
Expand Down

0 comments on commit 1c18c2b

Please sign in to comment.