Skip to content

Commit

Permalink
reuse helper fn and add comment (#14075)
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski committed Nov 29, 2022
1 parent 04f9ad2 commit 8c6181a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (

const iavlDisablefastNodeDefault = false

// keysForStoreKeyMap returns a slice of keys for the provided map lexically sorted by StoreKey.Name()
func keysForStoreKeyMap[V any](m map[types.StoreKey]V) []types.StoreKey {
keys := make([]types.StoreKey, 0, len(m))
for key := range m {
Expand Down Expand Up @@ -953,14 +954,7 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID
}

func (rs *Store) buildCommitInfo(version int64) *types.CommitInfo {
keys := make([]types.StoreKey, 0, len(rs.stores))
for key := range rs.stores {
keys = append(keys, key)
}
sort.Slice(keys, func(i, j int) bool {
return keys[i].Name() < keys[j].Name()
})

keys := keysForStoreKeyMap(rs.stores)
storeInfos := []types.StoreInfo{}
for _, key := range keys {
store := rs.stores[key]
Expand Down

0 comments on commit 8c6181a

Please sign in to comment.