directly parse peer IDs as peer IDs
No need to parse it as a hash first. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Aug 29, 2018 at 16:08 UTC
ef18aa148b7c8ba2d385a83d74cf174af6498de5
1 file changed
+1
-7
namesys/routing.go
+1
-7
@@ -55,19 +55,13 @@ func (r *IpnsResolver) resolveOnce(ctx context.Context, name string, options *op
55
}
56
57
name = strings.TrimPrefix(name, "/ipns/")
58
- hash, err := mh.FromB58String(name)
58
+ pid, err := peer.IDB58Decode(name)
59
if err != nil {
60
// name should be a multihash. if it isn't, error out here.
61
log.Debugf("RoutingResolver: bad input hash: [%s]\n", name)
62
return "", 0, err
63
}
64
65
- pid, err := peer.IDFromBytes(hash)
66
- if err != nil {
67
- log.Debugf("RoutingResolver: could not convert public key hash %s to peer ID: %s\n", name, err)
68
- return "", 0, err
69
- }
70
-
65
// Name should be the hash of a public key retrievable from ipfs.
66
// We retrieve the public key here to make certain that it's in the peer
67
// store before calling GetValue() on the DHT - the DHT will call the