cmd, eth: support switching client modes of operation

This commit is contained in:
Péter Szilágyi
2015-09-01 17:35:14 +03:00
parent 10ed107ba2
commit 92f9a3e5fa
8 changed files with 122 additions and 35 deletions

View File

@ -89,6 +89,7 @@ type Config struct {
GenesisFile string
GenesisBlock *types.Block // used by block tests
Olympic bool
Mode Mode
BlockChainVersion int
SkipBcVersionCheck bool // e.g. blockchain export
@ -398,8 +399,9 @@ func New(config *Config) (*Ethereum, error) {
eth.blockProcessor = core.NewBlockProcessor(chainDb, eth.pow, eth.blockchain, eth.EventMux())
eth.blockchain.SetProcessor(eth.blockProcessor)
eth.protocolManager = NewProtocolManager(config.NetworkId, eth.eventMux, eth.txPool, eth.pow, eth.blockchain, chainDb)
if eth.protocolManager, err = NewProtocolManager(config.Mode, config.NetworkId, eth.eventMux, eth.txPool, eth.pow, eth.blockchain, chainDb); err != nil {
return nil, err
}
eth.miner = miner.New(eth, eth.EventMux(), eth.pow)
eth.miner.SetGasPrice(config.GasPrice)
eth.miner.SetExtra(config.ExtraData)