eth: fix tests

This commit is contained in:
Felix Lange 2015-03-10 02:34:52 +01:00
parent ae38871a54
commit 9b3ae1fdb7

@ -25,7 +25,7 @@ import (
) )
var ( var (
ethlogger = logger.NewLogger("SERV") servlogger = logger.NewLogger("SERV")
jsonlogger = logger.NewJsonLogger() jsonlogger = logger.NewJsonLogger()
defaultBootNodes = []*discover.Node{ defaultBootNodes = []*discover.Node{
@ -74,7 +74,7 @@ func (cfg *Config) parseBootNodes() []*discover.Node {
} }
n, err := discover.ParseNode(url) n, err := discover.ParseNode(url)
if err != nil { if err != nil {
ethlogger.Errorf("Bootstrap URL %s: %v\n", url, err) servlogger.Errorf("Bootstrap URL %s: %v\n", url, err)
continue continue
} }
ns = append(ns, n) ns = append(ns, n)
@ -98,7 +98,7 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
return nil, fmt.Errorf("could not generate server key: %v", err) return nil, fmt.Errorf("could not generate server key: %v", err)
} }
if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil { if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil {
ethlogger.Errorln("could not persist nodekey: ", err) servlogger.Errorln("could not persist nodekey: ", err)
} }
return key, nil return key, nil
} }
@ -134,7 +134,7 @@ type Ethereum struct {
func New(config *Config) (*Ethereum, error) { func New(config *Config) (*Ethereum, error) {
// Boostrap database // Boostrap database
ethlogger := logger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat) servlogger := logger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
blockDb, err := ethdb.NewLDBDatabase(path.Join(config.DataDir, "blockchain")) blockDb, err := ethdb.NewLDBDatabase(path.Join(config.DataDir, "blockchain"))
if err != nil { if err != nil {
@ -161,7 +161,7 @@ func New(config *Config) (*Ethereum, error) {
blockDb: blockDb, blockDb: blockDb,
stateDb: stateDb, stateDb: stateDb,
eventMux: &event.TypeMux{}, eventMux: &event.TypeMux{},
logger: ethlogger, logger: servlogger,
accountManager: config.AccountManager, accountManager: config.AccountManager,
DataDir: config.DataDir, DataDir: config.DataDir,
} }
@ -256,7 +256,7 @@ func (s *Ethereum) Start() error {
s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{}) s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{})
go s.blockBroadcastLoop() go s.blockBroadcastLoop()
ethlogger.Infoln("Server started") servlogger.Infoln("Server started")
return nil return nil
} }
@ -284,7 +284,7 @@ func (s *Ethereum) Stop() {
s.whisper.Stop() s.whisper.Stop()
} }
ethlogger.Infoln("Server stopped") servlogger.Infoln("Server stopped")
close(s.shutdownChan) close(s.shutdownChan)
} }