Skip to content

Commit

Permalink
Revert "chore: new GetLatestVersion api (backport #961) (#962)"
Browse files Browse the repository at this point in the history
This reverts commit 8ecbd9f.
  • Loading branch information
cool-develope committed Jul 31, 2024
1 parent 984d49b commit d327306
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Changelog


### Improvements

- [#961](https://github.com/cosmos/iavl/pull/961) Add new `GetLatestVersion` API to get the latest version.
- [#965](https://github.com/cosmos/iavl/pull/965) Use expected interface for expected IAVL `Logger`.
- [#970](https://github.com/cosmos/iavl/pull/970) Close the pruning process when the nodeDB is closed.
- [#968](https://github.com/cosmos/iavl/pull/968) Get rid of `cosmos-db` deps completely.
Expand Down
5 changes: 0 additions & 5 deletions mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ func (tree *MutableTree) IsEmpty() bool {
return tree.ImmutableTree.Size() == 0
}

// GetLatestVersion returns the latest version of the tree.
func (tree *MutableTree) GetLatestVersion() (int64, error) {
return tree.ndb.getLatestVersion()
}

// VersionExists returns whether or not a version exists.
func (tree *MutableTree) VersionExists(version int64) bool {
legacyLatestVersion, err := tree.ndb.getLegacyLatestVersion()
Expand Down
6 changes: 1 addition & 5 deletions mutable_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,11 @@ func prepareTree(t *testing.T) *MutableTree {
return newTree
}

func TestMutableTree_Version(t *testing.T) {
func TestMutableTree_VersionExists(t *testing.T) {
tree := prepareTree(t)
require.True(t, tree.VersionExists(1))
require.True(t, tree.VersionExists(2))
require.False(t, tree.VersionExists(3))

v, err := tree.GetLatestVersion()
require.NoError(t, err)
require.Equal(t, int64(2), v)
}

func checkGetVersioned(t *testing.T, tree *MutableTree, version int64, key, value []byte) {
Expand Down

0 comments on commit d327306

Please sign in to comment.