Skip to content

Commit

Permalink
p2p/dnsdisc: use strings.Cut over strings.IndexByte (ethereum#28787)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddl-hust authored Jan 12, 2024
1 parent a608c0a commit 1335ba5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/dnsdisc/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ func parseLink(e string) (*linkEntry, error) {
return nil, fmt.Errorf("wrong/missing scheme 'enrtree' in URL")
}
e = e[len(linkPrefix):]
pos := strings.IndexByte(e, '@')
if pos == -1 {

keystring, domain, found := strings.Cut(e, "@")
if !found {
return nil, entryError{"link", errNoPubkey}
}
keystring, domain := e[:pos], e[pos+1:]
keybytes, err := b32format.DecodeString(keystring)
if err != nil {
return nil, entryError{"link", errBadPubkey}
Expand Down

0 comments on commit 1335ba5

Please sign in to comment.