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.
This commit is contained in:
Aaron Chen 2024-04-17 17:08:24 +08:00 committed by GitHub
parent 74e8d2da97
commit 8f4759db9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(),