diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-11 21:43:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-11 23:21:22 +0800 |
commit | 21e52efdfed19c4376b830f8ad0e52a9e599f633 (patch) | |
tree | a3d6f2be23c64881461892572adc9d1b55cd4b39 /eth | |
parent | 064cf1609987bb0f6c59c1e790b7811d9a783fef (diff) | |
download | go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.gz go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.bz2 go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.lz go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.xz go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.zst go-tangerine-21e52efdfed19c4376b830f8ad0e52a9e599f633.zip |
cmd/geth, miner, backend, xeth: Fixed miner threads to be settable
Miner threads are now settable through the admin interface (closes #897)
and specify 0 CPU worker threads when eth_getWork is called (closes #916)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/eth/backend.go b/eth/backend.go index cdbe35b26..6be871138 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -267,7 +267,7 @@ func New(config *Config) (*Ethereum, error) { eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit) eth.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.txPool, eth.chainManager, eth.EventMux()) eth.chainManager.SetProcessor(eth.blockProcessor) - eth.miner = miner.New(eth, eth.pow, config.MinerThreads) + eth.miner = miner.New(eth, eth.pow) eth.miner.SetGasPrice(config.GasPrice) eth.protocolManager = NewProtocolManager(config.ProtocolVersion, config.NetworkId, eth.eventMux, eth.txPool, eth.chainManager, eth.downloader) @@ -368,7 +368,7 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) { s.chainManager.ResetWithGenesisBlock(gb) } -func (s *Ethereum) StartMining() error { +func (s *Ethereum) StartMining(threads int) error { eb, err := s.Etherbase() if err != nil { err = fmt.Errorf("Cannot start mining without etherbase address: %v", err) @@ -376,7 +376,7 @@ func (s *Ethereum) StartMining() error { return err } - go s.miner.Start(eb) + go s.miner.Start(eb, threads) return nil } @@ -461,13 +461,13 @@ done: case <-ticker.C: // don't change the order of database flushes if err := s.extraDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush extraDb: %v\n", err) + glog.Fatalf("fatal error: flush extraDb: %v (Restart your node. We are aware of this issue)\n", err) } if err := s.stateDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush stateDb: %v\n", err) + glog.Fatalf("fatal error: flush stateDb: %v (Restart your node. We are aware of this issue)\n", err) } if err := s.blockDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush blockDb: %v\n", err) + glog.Fatalf("fatal error: flush blockDb: %v (Restart your node. We are aware of this issue)\n", err) } case <-s.shutdownChan: break done |