Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions integration/simulation/validate_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math/big"
"slices"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -771,10 +772,8 @@ func assertRelevantLogsOnly(t *testing.T, owner string, receivedLog types.Log) {
return
}

for _, addr := range userAddrs {
if addr == owner {
return
}
if slices.Contains(userAddrs, owner) {
return
}

// If we've fallen through to here, it means the log was not relevant.
Expand Down
8 changes: 2 additions & 6 deletions lib/gethfork/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"path/filepath"
"reflect"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -229,12 +230,7 @@ func (n *Node) openEndpoints() error {

// containsLifecycle checks if 'lfs' contains 'l'.
func containsLifecycle(lfs []Lifecycle, l Lifecycle) bool {
for _, obj := range lfs {
if obj == l {
return true
}
}
return false
return slices.Contains(lfs, l)
}

// stopServices terminates running services, RPC and p2p networking.
Expand Down
7 changes: 3 additions & 4 deletions lib/gethfork/rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"mime"
"net/http"
"net/url"
"slices"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -356,10 +357,8 @@ func (s *Server) validateRequest(r *http.Request) (int, error) {
}
// Check content-type
if mt, _, err := mime.ParseMediaType(r.Header.Get("content-type")); err == nil {
for _, accepted := range acceptedContentTypes {
if accepted == mt {
return 0, nil
}
if slices.Contains(acceptedContentTypes, mt) {
return 0, nil
}
}
// Invalid content-type
Expand Down