ibc: remove GetClientConsensusStateLTE (#7812)

This commit is contained in:
Federico Kunze 2020-11-05 14:46:00 +01:00 committed by GitHub
parent 71166c8949
commit 97963c71df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 21 deletions

View File

@ -156,22 +156,6 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string)
return k.GetClientConsensusState(ctx, clientID, clientState.GetLatestHeight())
}
// GetClientConsensusStateLTE will get the latest ConsensusState of a particular client at the latest height
// less than or equal to the given height
// It will only search for heights within the same version
func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, maxHeight exported.Height) (exported.ConsensusState, bool) {
h := maxHeight
ok := true
for ok {
found := k.HasClientConsensusState(ctx, clientID, h)
if found {
return k.GetClientConsensusState(ctx, clientID, h)
}
h, ok = h.Decrement()
}
return nil, false
}
// GetSelfConsensusState introspects the (self) past historical info at a given height
// and returns the expected consensus state at that height.
// For now, can only retrieve self consensus states for the current version

View File

@ -340,11 +340,6 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID)
suite.Require().True(ok)
suite.Require().Equal(nextState, latest, "Latest client not returned correctly")
// Should return existing consensusState at latestClientHeight
lte, ok := suite.keeper.GetClientConsensusStateLTE(suite.ctx, testClientID, types.NewHeight(0, height+3))
suite.Require().True(ok)
suite.Require().Equal(suite.consensusState, lte, "LTE helper function did not return latest client state below height: %d", height+3)
}
// 2 clients in total are created on chainA. The first client is updated so it contains an initial consensus state