Skip to content

Commit

Permalink
Try extracting public key from peer identity
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinDrake committed May 12, 2017
1 parent f02c72d commit b77c03a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion records.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit b77c03a

Please sign in to comment.