From 8c45da306a8b637cb84d282e8f7dbff3be0b8284 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Feb 2022 09:53:15 +0100 Subject: [PATCH] feat: add get all versions (backport #11124) (#11145) * feat: add get all versions (#11124) * add get all versions * add changelog entry (cherry picked from commit d624a656795b55a1244c36c123f0a782e245334c) # Conflicts: # CHANGELOG.md * fix conflicts and remove interface break Co-authored-by: Marko --- CHANGELOG.md | 3 +++ store/iavl/store.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b962190ca0b..29c8d01ccbb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [v0.44.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.6) - 2022-02-02 +### Features + +* [\#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store ### Bug Fixes * (grpc) [\#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist. diff --git a/store/iavl/store.go b/store/iavl/store.go index dcd3aed68c82..e65fdb6af9ae 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -143,6 +143,11 @@ func (st *Store) VersionExists(version int64) bool { return st.tree.VersionExists(version) } +// GetAllVersions returns all versions in the iavl tree +func (st *Store) GetAllVersions() []int { + return st.tree.(*iavl.MutableTree).AvailableVersions() +} + // Implements Store. func (st *Store) GetStoreType() types.StoreType { return types.StoreTypeIAVL