Skip to content

Commit df1d5af

Browse files
committed
go/consensus/cometbft/light: Add FirstTrustedHeight method
1 parent 91d21cf commit df1d5af

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go/consensus/cometbft/light/client.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ func (c *Client) LastTrustedHeight() (int64, error) {
122122
return height, nil
123123
}
124124

125+
// FirstTrustedHeight returns the first (oldest) trusted height.
126+
func (c *Client) FirstTrustedHeight() (int64, error) {
127+
height, err := c.lightClient.FirstTrustedHeight()
128+
if err != nil {
129+
return 0, err
130+
}
131+
if height == -1 {
132+
return 0, fmt.Errorf("no trusted headers")
133+
}
134+
return height, nil
135+
}
136+
125137
// VerifyHeader verifies the given header.
126138
func (c *Client) VerifyHeader(ctx context.Context, header *cmttypes.Header) error {
127139
c.mu.Lock()

0 commit comments

Comments
 (0)