From 6b39e9236c278d9c4722505bb88a769fd21ca4b8 Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Thu, 4 Apr 2024 17:58:44 +0800 Subject: [PATCH] beacon/engine: using slices.Contains (#29396) --- beacon/engine/types.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/beacon/engine/types.go b/beacon/engine/types.go index 8281fd794c..fc77c13af7 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -19,6 +19,7 @@ package engine import ( "fmt" "math/big" + "slices" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -132,12 +133,7 @@ func (b PayloadID) Version() PayloadVersion { // Is returns whether the identifier matches any of provided payload versions. func (b PayloadID) Is(versions ...PayloadVersion) bool { - for _, v := range versions { - if v == b.Version() { - return true - } - } - return false + return slices.Contains(versions, b.Version()) } func (b PayloadID) String() string {