eth/tracers/logger: using maps.Equal

This commit is contained in:
cuiweixie 2024-03-28 18:38:26 +08:00
parent 767b00b0b5
commit 560a12b182

View file

@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"maps"
) )
// accessList is an accumulator for the set of accounts and storage slots an EVM // accessList is an accumulator for the set of accounts and storage slots an EVM
@ -71,17 +72,9 @@ func (al accessList) equal(other accessList) bool {
// Accounts match, cross reference the storage slots too // Accounts match, cross reference the storage slots too
for addr, slots := range al { for addr, slots := range al {
otherslots := other[addr] otherslots := other[addr]
if !maps.Equal(slots, otherslots) {
if len(slots) != len(otherslots) {
return false return false
} }
// Given that len(slots) == len(otherslots), we only need to check that
// all the items from slots are in otherslots.
for hash := range slots {
if _, ok := otherslots[hash]; !ok {
return false
}
}
} }
return true return true
} }