diff options
author | Felix Lange <fjl@twurst.com> | 2015-02-10 19:30:09 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-10 19:30:09 +0800 |
commit | a3cd2187194b79cd8b14c4ec4f1abca91a0147e0 (patch) | |
tree | b0974958a028932a51424c312e76df849a777f05 /eth | |
parent | 0c7df37351ab85c577fe815d6d22f4627832b0c3 (diff) | |
download | go-tangerine-a3cd2187194b79cd8b14c4ec4f1abca91a0147e0.tar.gz go-tangerine-a3cd2187194b79cd8b14c4ec4f1abca91a0147e0.tar.zst go-tangerine-a3cd2187194b79cd8b14c4ec4f1abca91a0147e0.zip |
cmd/mist, cmd/ethereum: add CLI arguments for node key
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/eth/backend.go b/eth/backend.go index f5ebc9033..e8555061d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -1,6 +1,7 @@ package eth import ( + "crypto/ecdsa" "fmt" "strings" "sync" @@ -37,6 +38,10 @@ type Config struct { // discovery node URLs. BootNodes string + // This key is used to identify the node on the network. + // If nil, an ephemeral key is used. + NodeKey *ecdsa.PrivateKey + Shh bool Dial bool @@ -150,9 +155,11 @@ func New(config *Config) (*Ethereum, error) { if err != nil { return nil, err } - netprv, err := crypto.GenerateKey() - if err != nil { - return nil, fmt.Errorf("could not generate server key: %v", err) + netprv := config.NodeKey + if netprv == nil { + if netprv, err = crypto.GenerateKey(); err != nil { + return nil, fmt.Errorf("could not generate server key: %v", err) + } } eth.net = &p2p.Server{ PrivateKey: netprv, |