Skip to content

Commit

Permalink
fix: move away from deprecated peer ID functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien authored and Walter Beegle committed Jun 6, 2020
1 parent 8dd3004 commit 3b72da8
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions core/commands/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Print out all blocks currently on the bitswap wantlist for the local peer.`,

pstr, found := req.Options[peerOptionName].(string)
if found {
pid, err := peer.IDB58Decode(pstr)
pid, err := peer.Decode(pstr)
if err != nil {
return err
}
Expand Down Expand Up @@ -195,7 +195,7 @@ prints the ledger associated with a given peer.
return e.TypeErr(bs, nd.Exchange)
}

partner, err := peer.IDB58Decode(req.Arguments[0])
partner, err := peer.Decode(req.Arguments[0])
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var queryDhtCmd = &cmds.Command{
return ErrNotDHT
}

id, err := peer.IDB58Decode(req.Arguments[0])
id, err := peer.Decode(req.Arguments[0])
if err != nil {
return cmds.ClientError("invalid peer ID")
}
Expand Down Expand Up @@ -370,7 +370,7 @@ var findPeerDhtCmd = &cmds.Command{
return ErrNotOnline
}

pid, err := peer.IDB58Decode(req.Arguments[0])
pid, err := peer.Decode(req.Arguments[0])
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ EXAMPLE:
var id peer.ID
if len(req.Arguments) > 0 {
var err error
id, err = peer.IDB58Decode(req.Arguments[0])
id, err = peer.Decode(req.Arguments[0])
if err != nil {
return fmt.Errorf("invalid peer id")
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/name/ipnsps.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var ipnspsSubsCmd = &cmds.Command{
log.Errorf("ipns key not a valid peer ID: %s", err)
continue
}
paths = append(paths, "/ipns/"+peer.IDB58Encode(pid))
paths = append(paths, "/ipns/"+peer.Encode(pid))
}

return cmds.EmitOnce(res, &stringList{paths})
Expand All @@ -120,7 +120,7 @@ var ipnspsCancelCmd = &cmds.Command{

name := req.Arguments[0]
name = strings.TrimPrefix(name, "/ipns/")
pid, err := peer.IDB58Decode(name)
pid, err := peer.Decode(name)
if err != nil {
return cmds.Errorf(cmds.ErrClient, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ func ParsePeerParam(text string) (ma.Multiaddr, peer.ID, error) {
return transport, id, nil
}
// Raw peer ID
p, err := peer.IDB58Decode(text)
p, err := peer.Decode(text)
return nil, p, err
}
2 changes: 1 addition & 1 deletion core/commands/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Example:

var pid peer.ID
if pfound {
checkpid, err := peer.IDB58Decode(pstr)
checkpid, err := peer.Decode(pstr)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion core/node/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func Identity(cfg *config.Config) fx.Option {
return fx.Error(errors.New("no peer ID in config! (was 'ipfs init' run?)"))
}

id, err := peer.IDB58Decode(cid)
id, err := peer.Decode(cid)
if err != nil {
return fx.Error(fmt.Errorf("peer ID invalid: %s", err))
}
Expand Down
2 changes: 1 addition & 1 deletion namesys/namesys.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ func (ns *mpns) PublishWithEOL(ctx context.Context, name ci.PrivKey, value path.
if ttEol := time.Until(eol); ttEol < ttl {
ttl = ttEol
}
ns.cacheSet(peer.IDB58Encode(id), value, ttl)
ns.cacheSet(peer.Encode(id), value, ttl)
return nil
}
2 changes: 1 addition & 1 deletion namesys/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, option
}

name = strings.TrimPrefix(name, "/ipns/")
pid, err := peer.IDB58Decode(name)
pid, err := peer.Decode(name)
if err != nil {
log.Debugf("RoutingResolver: could not convert public key hash %s to peer ID: %s\n", name, err)
out <- onceResult{err: err}
Expand Down

0 comments on commit 3b72da8

Please sign in to comment.