core: use slices.Contains

Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
deepdring 2025-08-14 22:35:07 +08:00
parent 2dbb580f51
commit 4c16661ac2

View file

@ -20,6 +20,7 @@ import (
"context" "context"
crand "crypto/rand" crand "crypto/rand"
"math/rand" "math/rand"
"slices"
"testing" "testing"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -74,11 +75,8 @@ func TestMatcher(t *testing.T) {
t.Fatalf("Log search error: %v", err) t.Fatalf("Log search error: %v", err)
} }
var found bool var found bool
for _, l := range logs { if slices.Contains(logs, log) {
if l == log {
found = true found = true
break
}
} }
if !found { if !found {
t.Fatalf("Log search did not return expected log (addresses: %v, topics: %v, expected log: %v)", addresses, topics, *log) t.Fatalf("Log search did not return expected log (addresses: %v, topics: %v, expected log: %v)", addresses, topics, *log)