Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
05346dd9
Commit
05346dd9
authored
Nov 11, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc(core/identity) more specific function argument
to aid in testing
parent
1ed0850c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
core/core.go
core/core.go
+6
-6
No files found.
core/core.go
View file @
05346dd9
...
...
@@ -121,7 +121,7 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
// setup peerstore + local peer identity
n
.
Peerstore
=
peer
.
NewPeerstore
()
n
.
Identity
,
err
=
initIdentity
(
n
.
Config
,
n
.
Peerstore
,
online
)
n
.
Identity
,
err
=
initIdentity
(
&
n
.
Config
.
Identity
,
n
.
Peerstore
,
online
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -196,17 +196,17 @@ func (n *IpfsNode) OnlineMode() bool {
return
n
.
onlineMode
}
func
initIdentity
(
cfg
*
config
.
Config
,
peers
peer
.
Peerstore
,
online
bool
)
(
peer
.
Peer
,
error
)
{
if
cfg
.
Identity
.
PeerID
==
""
{
func
initIdentity
(
cfg
*
config
.
Identity
,
peers
peer
.
Peerstore
,
online
bool
)
(
peer
.
Peer
,
error
)
{
if
cfg
.
PeerID
==
""
{
return
nil
,
errors
.
New
(
"Identity was not set in config (was ipfs init run?)"
)
}
if
len
(
cfg
.
Identity
.
PeerID
)
==
0
{
if
len
(
cfg
.
PeerID
)
==
0
{
return
nil
,
errors
.
New
(
"No peer ID in config! (was ipfs init run?)"
)
}
// get peer from peerstore (so it is constructed there)
id
:=
peer
.
ID
(
b58
.
Decode
(
cfg
.
Identity
.
PeerID
))
id
:=
peer
.
ID
(
b58
.
Decode
(
cfg
.
PeerID
))
self
,
err
:=
peers
.
Get
(
id
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -214,7 +214,7 @@ func initIdentity(cfg *config.Config, peers peer.Peerstore, online bool) (peer.P
// when not online, don't need to parse private keys (yet)
if
online
{
skb
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
cfg
.
Identity
.
PrivKey
)
skb
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
cfg
.
PrivKey
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment