mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
eth: use slices.Contains
Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
parent
2dbb580f51
commit
28ea145121
2 changed files with 4 additions and 12 deletions
|
|
@ -20,6 +20,7 @@ package catalyst
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
|
@ -906,12 +907,7 @@ func (api *ConsensusAPI) config() *params.ChainConfig {
|
|||
// is one of the forks provided.
|
||||
func (api *ConsensusAPI) checkFork(timestamp uint64, forks ...forks.Fork) bool {
|
||||
latest := api.config().LatestFork(timestamp)
|
||||
for _, fork := range forks {
|
||||
if latest == fork {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(forks, latest)
|
||||
}
|
||||
|
||||
// ExchangeCapabilities returns the current methods provided by this node.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package native
|
|||
import (
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
"slices"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
|
||||
|
|
@ -75,12 +76,7 @@ func newFourByteTracer(ctx *tracers.Context, cfg json.RawMessage, chainConfig *p
|
|||
|
||||
// isPrecompiled returns whether the addr is a precompile. Logic borrowed from newJsTracer in eth/tracers/js/tracer.go
|
||||
func (t *fourByteTracer) isPrecompiled(addr common.Address) bool {
|
||||
for _, p := range t.activePrecompiles {
|
||||
if p == addr {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(t.activePrecompiles, addr)
|
||||
}
|
||||
|
||||
// store saves the given identifier and datasize.
|
||||
|
|
|
|||
Loading…
Reference in a new issue