refactor(store,x/params): using maps.Copy (#19889)

Co-authored-by: weixie.c <weixie.c@kaitaitech.cn>
This commit is contained in:
cui
2024-03-28 10:44:33 +00:00
committed by GitHub
co-authored by weixie.c
parent f630cfb739
commit 705fad65d8
2 changed files with 4 additions and 7 deletions
+2 -3
View File
@@ -2,6 +2,7 @@ package types
import (
"fmt"
"maps"
"reflect"
"cosmossdk.io/store/prefix"
@@ -57,9 +58,7 @@ func (s Subspace) WithKeyTable(table KeyTable) Subspace {
panic("WithKeyTable() called on already initialized Subspace")
}
for k, v := range table.m {
s.table.m[k] = v
}
maps.Copy(s.table.m, table.m)
// Allocate additional capacity for Subspace.name
// So we don't have to allocate extra space each time appending to the key