Skip to content

Commit 4546610

Browse files
committed
go/consensus/cometbft/stateless: Fix GetLastRetainedHeight method
1 parent df1d5af commit 4546610

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.changelog/6382.bugfix.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
stateless-client: Fix incorrect GetLastRetainedHeight method
2+
3+
Previously, this method would return one of the provider's last retained
4+
heights which could cause issues with runtime light history reindexing.
5+
6+
This has been fixed, by setting the last retained height to the
7+
light client's last retained height, as this is the oldest height
8+
the stateless client can use to verify consensus data against.

go/consensus/cometbft/stateless/core.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ func (c *Core) GetGenesisDocument(context.Context) (*genesisAPI.Document, error)
156156

157157
// GetLastRetainedHeight implements api.Backend.
158158
func (c *Core) GetLastRetainedHeight(ctx context.Context) (int64, error) {
159-
// The last retained height cannot be verified, nor does it need to be,
160-
// as it is not sensitive information.
161-
return c.provider.GetLastRetainedHeight(ctx)
159+
// The last retained height equals to the last retained light client height
160+
// as this is the oldest height stateless client can verify the data against.
161+
return c.lightClient.FirstTrustedHeight()
162162
}
163163

164164
// GetLatestHeight implements api.Backend.

0 commit comments

Comments
 (0)