Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppressing error msg for NoSecurity option #498

Merged
merged 5 commits into from
Dec 3, 2018

Conversation

upperwal
Copy link
Contributor

identity displays an error if libp2p.NoSecurity option is used. This change will suppress it by also checking for private key.

@upperwal
Copy link
Contributor Author

Resolves #493

@@ -186,9 +186,11 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) {

// set our public key
ownKey := ids.Host.Peerstore().PubKey(ids.Host.ID())
if ownKey == nil {
prKey := ids.Host.Peerstore().PrivKey(ids.Host.ID())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it clear why we're checking for the private key. Something like:

if ownKey == nil {
  // check if we're even operating in "secure mode"
  if ids.Host.Peerstore().PrivKey(ids.Host.ID()) != nil {
    // warn
  }
} else ...

(this also avoid storing the private key to make it clear that we're just checking to see if we have it)

@Stebalien Stebalien merged commit a17052f into libp2p:master Dec 3, 2018
@upperwal upperwal deleted the identity branch December 4, 2018 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants