From fce917760785a490957749a81eff221eab65d11e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Feb 2022 10:08:36 +0100 Subject: [PATCH] feat: add get all versions (backport #11124) (#11144) * 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 | 4 ++++ store/iavl/store.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14dc585950cc..79d1e2f58620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +* [\#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store + ### Bug Fixes * (store) [\#11117](https://github.com/cosmos/cosmos-sdk/pull/11117) Fix data race in store trace component diff --git a/store/iavl/store.go b/store/iavl/store.go index 29a4d9871139..4b15cf73ea19 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