From 0b126dbcf392667f8e6de22a8b7a7248a3e5c0cf Mon Sep 17 00:00:00 2001 From: gitglorythegreat Date: Tue, 10 Dec 2024 21:25:11 +0800 Subject: [PATCH] core/state: use function name directly --- core/state/access_list.go | 5 +---- core/state/statedb_test.go | 14 +++----------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/core/state/access_list.go b/core/state/access_list.go index 90e5590748cf..a58c2b20ea96 100644 --- a/core/state/access_list.go +++ b/core/state/access_list.go @@ -139,10 +139,7 @@ func (al *accessList) Equal(other *accessList) bool { if !maps.Equal(al.addresses, other.addresses) { return false } - return slices.EqualFunc(al.slots, other.slots, - func(m map[common.Hash]struct{}, m2 map[common.Hash]struct{}) bool { - return maps.Equal(m, m2) - }) + return slices.EqualFunc(al.slots, other.slots, maps.Equal) } // PrettyPrint prints the contents of the access list in a human-readable form diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index 57886e6e0390..37141e90b021 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -650,11 +650,7 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error { { have := state.transientStorage want := checkstate.transientStorage - eq := maps.EqualFunc(have, want, - func(a Storage, b Storage) bool { - return maps.Equal(a, b) - }) - if !eq { + if !maps.EqualFunc(have, want, maps.Equal) { return fmt.Errorf("transient storage differs ,have\n%v\nwant\n%v", have.PrettyPrint(), want.PrettyPrint()) @@ -1034,12 +1030,8 @@ func testMissingTrieNodes(t *testing.T, scheme string) { func TestStateDBAccessList(t *testing.T) { // Some helpers - addr := func(a string) common.Address { - return common.HexToAddress(a) - } - slot := func(a string) common.Hash { - return common.HexToHash(a) - } + addr := common.HexToAddress + slot := common.HexToHash db := NewDatabaseForTesting() state, _ := New(types.EmptyRootHash, db)