File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ func (s *nodeSet) decode(r *rlp.Stream) error {
259259 }
260260 } else {
261261 // Storage nodes
262- subset := make (map [string ]* trienode.Node )
262+ subset := make (map [string ]* trienode.Node , len ( entry . Nodes ) )
263263 for _ , n := range entry .Nodes {
264264 if len (n .Blob ) > 0 {
265265 subset [string (n .Path )] = trienode .New (crypto .Keccak256Hash (n .Blob ), n .Blob )
@@ -276,13 +276,11 @@ func (s *nodeSet) decode(r *rlp.Stream) error {
276276
277277// write flushes nodes into the provided database batch as a whole.
278278func (s * nodeSet ) write (batch ethdb.Batch , clean * fastcache.Cache ) int {
279- nodes := make (map [common.Hash ]map [string ]* trienode.Node )
279+ nodes := make (map [common.Hash ]map [string ]* trienode.Node , len ( s . storageNodes ) + 1 )
280280 if len (s .accountNodes ) > 0 {
281281 nodes [common.Hash {}] = s .accountNodes
282282 }
283- for owner , subset := range s .storageNodes {
284- nodes [owner ] = subset
285- }
283+ maps .Copy (nodes , s .storageNodes )
286284 return writeNodes (batch , nodes , clean )
287285}
288286
You can’t perform that action at this time.
0 commit comments