Browse Source
Merge pull request #576 from libp2p/fix/constructor-nits
chore: fail in the libp2p constructor if we fail to store the key
pull/581/head
Steven Allen
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
2 deletions
-
config/config.go
|
|
@ -99,8 +99,12 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { |
|
|
|
} |
|
|
|
|
|
|
|
if !cfg.Insecure { |
|
|
|
cfg.Peerstore.AddPrivKey(pid, cfg.PeerKey) |
|
|
|
cfg.Peerstore.AddPubKey(pid, cfg.PeerKey.GetPublic()) |
|
|
|
if err := cfg.Peerstore.AddPrivKey(pid, cfg.PeerKey); err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if err := cfg.Peerstore.AddPubKey(pid, cfg.PeerKey.GetPublic()); err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: Make the swarm implementation configurable.
|
|
|
|