Commit b77c03a0 authored by Justin's avatar Justin Committed by GitHub

Try extracting public key from peer identity

See https://github.com/ipfs/go-ipfs/issues/3896. Depends on https://github.com/libp2p/go-libp2p-peer/pull/13.
parent f02c72d5
......@@ -24,8 +24,14 @@ const MaxRecordAge = time.Hour * 36
func (dht *IpfsDHT) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) {
log.Debugf("getPublicKey for: %s", p)
// try extracting from identity.
pk := p.ExtractPublicKey()
if pk != nil {
return pk, nil
}
// check locally.
pk := dht.peerstore.PubKey(p)
pk = dht.peerstore.PubKey(p)
if pk != nil {
return pk, nil
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment