Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetTrustedHeader #390

Merged
merged 3 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion relayer/client-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (c *Chain) UpgradeClients(dst *Chain, height int64) error {
// TODO: construct method of only attempting to get dst header
// Note: we explicitly do not check the error since the source
// trusted header will fail
_, dstUpdateHeader, _ := sh.GetTrustedHeaders(c, dst)
dstUpdateHeader, _ := sh.GetTrusteddsthHeader(c, dst)

// query proofs on counterparty
clientState, proofUpgradeClient, _, err := dst.QueryUpgradedClient(height)
Expand Down
10 changes: 10 additions & 0 deletions relayer/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ func (uh *SyncHeaders) GetTrustedHeaders(src, dst *Chain) (srcTh, dstTh *tmclien
return
}

func (uh *SyncHeaders) GetTrusteddsthHeader(src, dst *Chain) (dstTh *tmclient.Header, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to GetTrustedHeader, but construct the call like:

sh.GetTrsutedHeader(dst, c)

note the swapping. This way we can reuse this function for source if needed

eg := new(errgroup.Group)
eg.Go(func() error {
dstTh, err = InjectTrustedFields(dst, src, uh.GetHeader(dst.ChainID))
return err
})
err = eg.Wait()
return
}

// InjectTrustedFields injects the necessary trusted fields for a srcHeader coming from a srcChain
// destined for an IBC client stored on the dstChain
// TrustedHeight is the latest height of the IBC client on dstChain
Expand Down