core/state: reduce one alloc

This commit is contained in:
cuiweixie 2025-10-25 20:27:28 +08:00
parent cfa3b96103
commit 726939bfbc
No known key found for this signature in database
GPG key ID: 16DF64EE15E495A3

View file

@ -61,9 +61,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)
}