From 28a32915b7afc68c04a85b815d51c218fe8da124 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 1 Dec 2014 08:34:07 +0000 Subject: [PATCH] fix for #381 --- core/commands/id.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/commands/id.go b/core/commands/id.go index ba8f9c5d0d9..a87f3517322 100644 --- a/core/commands/id.go +++ b/core/commands/id.go @@ -66,6 +66,7 @@ if no peer is specified, prints out local peers info. p, err := node.Routing.FindPeer(ctx, id) if err == kb.ErrLookupFailure { + log.Error("what? no.") return nil, errors.New(offlineIdErrorMessage) } if err != nil { @@ -93,15 +94,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()) }