fix incorrect usage of peer.IDFromString (should be peer.Decode)
This commit is contained in:
parent
c4ad7c81e2
commit
d52f01a19f
@ -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)
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user