@@ -195,7 +195,11 @@ func accountSnapshotKey(hash common.Hash) []byte {
195
195
196
196
// storageSnapshotKey = SnapshotStoragePrefix + account hash + storage hash
197
197
func storageSnapshotKey (accountHash , storageHash common.Hash ) []byte {
198
- return append (append (SnapshotStoragePrefix , accountHash .Bytes ()... ), storageHash .Bytes ()... )
198
+ buf := make ([]byte , len (SnapshotStoragePrefix )+ common .HashLength + common .HashLength )
199
+ n := copy (buf , SnapshotStoragePrefix )
200
+ n += copy (buf [n :], accountHash .Bytes ())
201
+ copy (buf [n :], storageHash .Bytes ())
202
+ return buf
199
203
}
200
204
201
205
// storageSnapshotsKey = SnapshotStoragePrefix + account hash + storage hash
@@ -259,7 +263,11 @@ func accountTrieNodeKey(path []byte) []byte {
259
263
260
264
// storageTrieNodeKey = trieNodeStoragePrefix + accountHash + nodePath.
261
265
func storageTrieNodeKey (accountHash common.Hash , path []byte ) []byte {
262
- return append (append (trieNodeStoragePrefix , accountHash .Bytes ()... ), path ... )
266
+ buf := make ([]byte , len (trieNodeStoragePrefix )+ common .HashLength + len (path ))
267
+ n := copy (buf , trieNodeStoragePrefix )
268
+ n += copy (buf [n :], accountHash .Bytes ())
269
+ copy (buf [n :], path )
270
+ return buf
263
271
}
264
272
265
273
// IsLegacyTrieNode reports whether a provided database entry is a legacy trie
0 commit comments