triedb/pathdb: prealloc node map in nodeSet.write (#35232)

This commit is contained in:
cui 2026-06-30 21:12:06 +08:00 committed by GitHub
parent 04bf045303
commit 32986bf084
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -279,7 +279,7 @@ func (s *nodeSet) decode(r *rlp.Stream) error {
// write flushes nodes into the provided database batch as a whole.
func (s *nodeSet) write(batch ethdb.Batch, clean *fastcache.Cache) int {
nodes := make(map[common.Hash]map[string]*trienode.Node)
nodes := make(map[common.Hash]map[string]*trienode.Node, len(s.storageNodes)+1)
if len(s.accountNodes) > 0 {
nodes[common.Hash{}] = s.accountNodes
}