"error creating swarm" message when no error fixed

This commit is contained in:
zelig 2015-06-01 16:26:27 +01:00
parent c4bca77d96
commit 1cfa386536

View file

@ -88,6 +88,7 @@ type Config struct {
Dial bool Dial bool
Bzz bool Bzz bool
BzzPort string BzzPort string
PowTest bool
Etherbase string Etherbase string
GasPrice *big.Int GasPrice *big.Int
@ -288,7 +289,14 @@ func New(config *Config) (*Ethereum, error) {
AutoDAG: config.AutoDAG, AutoDAG: config.AutoDAG,
} }
if config.PowTest {
eth.pow, err = ethash.NewForTesting()
if err != nil {
return nil, err
}
} else {
eth.pow = ethash.New() eth.pow = ethash.New()
}
eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.pow, eth.EventMux()) eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.pow, eth.EventMux())
eth.downloader = downloader.New(eth.EventMux(), eth.chainManager.HasBlock, eth.chainManager.GetBlock) eth.downloader = downloader.New(eth.EventMux(), eth.chainManager.HasBlock, eth.chainManager.GetBlock)
eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit) eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit)
@ -312,13 +320,19 @@ func New(config *Config) (*Ethereum, error) {
if config.Bzz { if config.Bzz {
eth.Swarm, err = bzz.NewApi(config.DataDir, config.BzzPort) eth.Swarm, err = bzz.NewApi(config.DataDir, config.BzzPort)
if err != nil {
glog.V(logger.Warn).Infof("BZZ: error creating swarm: %v. Protocol skipped", err)
} else {
var proto p2p.Protocol var proto p2p.Protocol
proto, err = eth.Swarm.Bzz() proto, err = eth.Swarm.Bzz()
if err == nil { if err != nil {
glog.V(logger.Warn).Infof("BZZ: error creating swarm: %v. Protocol skipped", err) glog.V(logger.Warn).Infof("BZZ: error creating swarm: %v. Protocol skipped", err)
eth.Swarm = nil
} else {
protocols = append(protocols, proto) protocols = append(protocols, proto)
} }
} }
}
if config.Shh { if config.Shh {
protocols = append(protocols, eth.whisper.Protocol()) protocols = append(protocols, eth.whisper.Protocol())