diff options
-rw-r--r-- | eth/backend.go | 1 | ||||
-rw-r--r-- | miner/miner.go | 5 | ||||
-rw-r--r-- | miner/worker.go | 6 | ||||
-rw-r--r-- | rpc/api/miner.go | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go index 2c6f5b80c..e5466bbc2 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -472,6 +472,7 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { // set in js console via admin interface or wrapper from cli flags func (self *Ethereum) SetEtherbase(etherbase common.Address) { self.etherbase = etherbase + self.miner.SetEtherbase(etherbase) } func (s *Ethereum) StopMining() { s.miner.Stop() } diff --git a/miner/miner.go b/miner/miner.go index 7f73f3ee8..83f7c4503 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -137,3 +137,8 @@ func (self *Miner) PendingState() *state.StateDB { func (self *Miner) PendingBlock() *types.Block { return self.worker.pendingBlock() } + +func (self *Miner) SetEtherbase(addr common.Address) { + self.coinbase = addr + self.worker.setEtherbase(addr) +} diff --git a/miner/worker.go b/miner/worker.go index 840609721..7be41118c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -124,6 +124,12 @@ func newWorker(coinbase common.Address, eth core.Backend) *worker { return worker } +func (self *worker) setEtherbase(addr common.Address) { + self.mu.Lock() + defer self.mu.Unlock() + self.coinbase = addr +} + func (self *worker) pendingState() *state.StateDB { self.currentMu.Lock() defer self.currentMu.Unlock() diff --git a/rpc/api/miner.go b/rpc/api/miner.go index 4e237751a..8d4646a5c 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -19,7 +19,7 @@ var ( "miner_makeDAG": (*minerApi).MakeDAG, "miner_setExtra": (*minerApi).SetExtra, "miner_setGasPrice": (*minerApi).SetGasPrice, - "admin_setEtherbase": (*minerApi).SetEtherbase, + "miner_setEtherbase": (*minerApi).SetEtherbase, "miner_startAutoDAG": (*minerApi).StartAutoDAG, "miner_start": (*minerApi).StartMiner, "miner_stopAutoDAG": (*minerApi).StopAutoDAG, |