core/state: reduce one alloc #33024 (#1784)

This commit is contained in:
wit liu 2025-11-24 13:30:15 +08:00 committed by GitHub
parent 9287ad4089
commit b8feb5cffc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,9 +58,10 @@ func newAccessList() *accessList {
// Copy creates an independent copy of an accessList.
func (al *accessList) Copy() *accessList {
cp := newAccessList()
cp.addresses = maps.Clone(al.addresses)
cp.slots = make([]map[common.Hash]struct{}, len(al.slots))
cp := &accessList{
addresses: maps.Clone(al.addresses),
slots: make([]map[common.Hash]struct{}, len(al.slots)),
}
for i, slotMap := range al.slots {
cp.slots[i] = maps.Clone(slotMap)
}