eth/tracers/logger: using maps.Equal #29384 (#1460)

Co-authored-by: cui <523516579@qq.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Daniel Liu 2025-09-13 10:10:24 +08:00 committed by GitHub
parent 604ba0ea14
commit bcf007335a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,8 @@
package logger
import (
"maps"
"github.com/XinFinOrg/XDPoSChain/common"
"github.com/XinFinOrg/XDPoSChain/core/tracing"
"github.com/XinFinOrg/XDPoSChain/core/types"
@ -71,17 +73,9 @@ func (al accessList) equal(other accessList) bool {
// Accounts match, cross reference the storage slots too
for addr, slots := range al {
otherslots := other[addr]
if len(slots) != len(otherslots) {
if !maps.Equal(slots, otherslots) {
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
}