From 8f4759db9d15df6488a93bf1423f784418f5ad51 Mon Sep 17 00:00:00 2001 From: Aaron Chen Date: Wed, 17 Apr 2024 17:08:24 +0800 Subject: [PATCH] core/state: remove unnecessary preallocation in StateDB.Copy Both stateObjectsDestruct and preimages fields are assigned by the value returned by maps.Clone. The preallocation is a waste. --- core/state/statedb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index d3d383389c..6f76d082d1 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -703,11 +703,11 @@ func (s *StateDB) Copy() *StateDB { stateObjects: make(map[common.Address]*stateObject, len(s.journal.dirties)), stateObjectsPending: make(map[common.Address]struct{}, len(s.stateObjectsPending)), stateObjectsDirty: make(map[common.Address]struct{}, len(s.journal.dirties)), - stateObjectsDestruct: make(map[common.Address]*types.StateAccount, len(s.stateObjectsDestruct)), + stateObjectsDestruct: make(map[common.Address]*types.StateAccount), refund: s.refund, logs: make(map[common.Hash][]*types.Log, len(s.logs)), logSize: s.logSize, - preimages: make(map[common.Hash][]byte, len(s.preimages)), + preimages: make(map[common.Hash][]byte), journal: newJournal(), hasher: crypto.NewKeccakState(),