Skip to content

Commit

Permalink
Merge pull request #8993 from filecoin-project/fix-peer-idfromstring
Browse files Browse the repository at this point in the history
fix incorrect usage of peer.IDFromString (should be peer.Decode)
  • Loading branch information
arajasek authored Jul 7, 2022
2 parents c4ad7c8 + d52f01a commit d8398ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit d8398ed

Please sign in to comment.