Skip to content

Commit

Permalink
Merge pull request #396 from jbenet/idcmd-fix
Browse files Browse the repository at this point in the history
Fix ID command lookups of unconnected nodes
  • Loading branch information
whyrusleeping committed Dec 1, 2014
2 parents ff23d2d + b0e915b commit 2ec2c85
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions core/commands/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ func printPeer(p peer.Peer) (interface{}, error) {
info := new(IdOutput)

info.ID = p.ID().String()
if p.PubKey() == nil {
return nil, errors.New(`peer publickey not populated on offline runs,
please run the daemon to use ipfs id!`)
}
pkb, err := p.PubKey().Bytes()
if err != nil {
return nil, err
if p.PubKey() != nil {
pkb, err := p.PubKey().Bytes()
if err != nil {
return nil, err
}
info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
}
info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
for _, a := range p.Addresses() {
info.Addresses = append(info.Addresses, a.String())
}
Expand Down

0 comments on commit 2ec2c85

Please sign in to comment.