diff options
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/eth/backend.go b/eth/backend.go index c4a883c9e..24419d6d8 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -362,6 +362,17 @@ func (self *Ethereum) SetEtherbase(etherbase common.Address) { self.miner.SetEtherbase(etherbase) } +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) + glog.V(logger.Error).Infoln(err) + return err + } + go s.miner.Start(eb, threads) + return nil +} + func (s *Ethereum) StopMining() { s.miner.Stop() } func (s *Ethereum) IsMining() bool { return s.miner.Mining() } func (s *Ethereum) Miner() *miner.Miner { return s.miner } |