ibc: remove GetClientConsensusStateLTE (#7812)
This commit is contained in:
parent
71166c8949
commit
97963c71df
|
@ -156,22 +156,6 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string)
|
||||||
return k.GetClientConsensusState(ctx, clientID, clientState.GetLatestHeight())
|
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
|
// GetSelfConsensusState introspects the (self) past historical info at a given height
|
||||||
// and returns the expected consensus state at that height.
|
// and returns the expected consensus state at that height.
|
||||||
// For now, can only retrieve self consensus states for the current version
|
// For now, can only retrieve self consensus states for the current version
|
||||||
|
|
|
@ -340,11 +340,6 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
|
||||||
latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID)
|
latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID)
|
||||||
suite.Require().True(ok)
|
suite.Require().True(ok)
|
||||||
suite.Require().Equal(nextState, latest, "Latest client not returned correctly")
|
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
|
// 2 clients in total are created on chainA. The first client is updated so it contains an initial consensus state
|
||||||
|
|
Loading…
Reference in New Issue