From e282ad25a83e93f7a5ac085e3580ee9051daad10 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 20 Feb 2015 15:24:19 +0100 Subject: [PATCH 1/3] eth: add poc-8.ethdev.com as second default bootstrap node --- eth/backend.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/backend.go b/eth/backend.go index b57e9fd69e..f060ec3b68 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -25,7 +25,10 @@ var ( jsonlogger = ethlogger.NewJsonLogger() defaultBootNodes = []*discover.Node{ + // ETH/DEV cmd/bootnode discover.MustParseNode("enode://6cdd090303f394a1cac34ecc9f7cda18127eafa2a3a06de39f6d920b0e583e062a7362097c7c65ee490a758b442acd5c80c6fce4b148c6a391e946b45131365b@54.169.166.226:30303"), + // ETH/DEV cpp-ethereum (poc-8.ethdev.com) + discover.MustParseNode("enode://4a44599974518ea5b0f14c31c4463692ac0329cb84851f3435e6d1b18ee4eae4aa495f846a0fa1219bd58035671881d44423876e57db2abd57254d0197da0ebe@5.1.83.226:30303"), } ) From e968928613a5d49ad67e921a52883268d4ad74d1 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 20 Feb 2015 15:26:50 +0100 Subject: [PATCH 2/3] eth: persist node key between sessions (#304) --- eth/backend.go | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index f060ec3b68..0e5d244297 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -3,6 +3,8 @@ package eth import ( "crypto/ecdsa" "fmt" + "io/ioutil" + "path" "strings" "github.com/ethereum/go-ethereum/core" @@ -80,6 +82,27 @@ func (cfg *Config) parseBootNodes() []*discover.Node { return ns } +func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) { + // use explicit key from command line args if set + if cfg.NodeKey != nil { + return cfg.NodeKey, nil + } + // use persistent key if present + keyfile := path.Join(cfg.DataDir, "nodekey") + key, err := crypto.LoadECDSA(keyfile) + if err == nil { + return key, nil + } + // no persistent key, generate and store a new one + if key, err = crypto.GenerateKey(); err != nil { + return nil, fmt.Errorf("could not generate server key: %v", err) + } + if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil { + logger.Errorln("could not persist nodekey: ", err) + } + return key, nil +} + type Ethereum struct { // Channel for shutting down the ethereum shutdownChan chan bool @@ -164,18 +187,16 @@ func New(config *Config) (*Ethereum, error) { insertChain := eth.chainManager.InsertChain eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify) + netprv, err := config.nodeKey() + if err != nil { + return nil, err + } ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) protocols := []p2p.Protocol{ethProto} if config.Shh { protocols = append(protocols, eth.whisper.Protocol()) } - 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, Name: config.Name, From d8f7cb2f55e7e8cf1c831b65e8962bb0bdd2599e Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sat, 21 Feb 2015 13:48:09 +0100 Subject: [PATCH 3/3] Don't print per-function testing results --- .travis.yml | 5 +++++ gocoverage.sh | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b31048267..5499cf2571 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,15 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -yqq libgmp3-dev libreadline6-dev qt54quickcontrols qt54webengine install: + # - go get code.google.com/p/go.tools/cmd/goimports + # - go get github.com/golang/lint/golint # - go get golang.org/x/tools/cmd/vet - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - go get github.com/mattn/goveralls before_script: + # - gofmt -l -w . + # - goimports -l -w . + # - golint . # - go vet ./... # - go test -race ./... script: diff --git a/gocoverage.sh b/gocoverage.sh index e54a5cab03..5479d8d3b7 100755 --- a/gocoverage.sh +++ b/gocoverage.sh @@ -29,6 +29,3 @@ if ls $dir/*.go &> /dev/null; then fi fi done - -go tool cover -func profile.cov -