Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix incorrect usage of peer.IDFromString (should be peer.Decode) #8993

Merged
merged 1 commit into from
Jul 7, 2022
Merged
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
6 changes: 3 additions & 3 deletions node/impl/net/rcmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (a *NetAPI) NetStat(ctx context.Context, scope string) (result api.NetStat,

case strings.HasPrefix(scope, "peer:"):
p := scope[5:]
pid, err := peer.IDFromString(p)
pid, err := peer.Decode(p)
if err != nil {
return result, xerrors.Errorf("invalid peer ID: %s: %w", p, err)
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func (a *NetAPI) NetLimit(ctx context.Context, scope string) (result api.NetLimi

case strings.HasPrefix(scope, "peer:"):
p := scope[5:]
pid, err := peer.IDFromString(p)
pid, err := peer.Decode(p)
if err != nil {
return result, xerrors.Errorf("invalid peer ID: %s: %w", p, err)
}
Expand Down Expand Up @@ -255,7 +255,7 @@ func (a *NetAPI) NetSetLimit(ctx context.Context, scope string, limit api.NetLim

case strings.HasPrefix(scope, "peer:"):
p := scope[5:]
pid, err := peer.IDFromString(p)
pid, err := peer.Decode(p)
if err != nil {
return xerrors.Errorf("invalid peer ID: %s: %w", p, err)
}
Expand Down
2 changes: 1 addition & 1 deletion node/modules/lp2p/libp2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func ConnectionManager(low, high uint, grace time.Duration, protected []string)
}

for _, p := range protected {
pid, err := peer.IDFromString(p)
pid, err := peer.Decode(p)
if err != nil {
return Libp2pOpts{}, xerrors.Errorf("failed to parse peer ID in protected peers array: %w", err)
}
Expand Down