@@ -34,6 +34,11 @@ type StateProver interface {
3434 ProveHostConsensusState (ctx QueryContext , height exported.Height , consensusState exported.ConsensusState ) (proof []byte , err error )
3535}
3636
37+ type HeaderOrError struct {
38+ Header Header
39+ Error error
40+ }
41+
3742// LightClient provides functions for creating and updating on-chain light clients on the counterparty chain
3843type LightClient interface {
3944 FinalityAware
@@ -44,9 +49,11 @@ type LightClient interface {
4449 CreateInitialLightClientState (ctx context.Context , height exported.Height ) (exported.ClientState , exported.ConsensusState , error )
4550
4651 // SetupHeadersForUpdate returns the finalized header and any intermediate headers needed to apply it to the client on the counterpaty chain
47- // The order of the returned header slice should be as: [<intermediate headers>..., <update header>]
48- // if the header slice's length == 0 and err == nil, the relayer should skips the update-client
49- SetupHeadersForUpdate (ctx context.Context , counterparty FinalityAwareChain , latestFinalizedHeader Header ) ([]Header , error )
52+ // CONTRACT:
53+ // 1. The order of the returned header stream should be as: [<intermediate headers>..., <update header>]
54+ // 2. If the header stream's length == 0 and err == nil, the relayer should skips the update-client
55+ // 3. Goroutines that create the header stream should check `ctx.Done()` and should terminate processing if `ctx` is cancelled by the caller.
56+ SetupHeadersForUpdate (ctx context.Context , counterparty FinalityAwareChain , latestFinalizedHeader Header ) (<- chan * HeaderOrError , error )
5057
5158 // CheckRefreshRequired returns if the on-chain light client needs to be updated.
5259 // For example, this requirement arises due to the trusting period mechanism.
0 commit comments