From d7b5a87b3bc4a19677877d3a8c8c925211eb25f1 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 11 Mar 2015 23:35:34 +0100 Subject: miner: provide coinbase when starting the miner This avoids having to query the coinbase when creating the miner, which in turn eliminates the dreaded startup error when no accounts are set up. Later, this will also allow us to simply restart the miner when the user picks a different coinbase. This causes a lot of changes in other packages. These are included in this commit because they're impossible to separate. --- cmd/ethereum/js.go | 6 ++++-- cmd/ethereum/main.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd/ethereum') diff --git a/cmd/ethereum/js.go b/cmd/ethereum/js.go index 5432fb9b1..3b98b588e 100644 --- a/cmd/ethereum/js.go +++ b/cmd/ethereum/js.go @@ -249,12 +249,14 @@ func (self *jsre) dump(call otto.FunctionCall) otto.Value { } func (self *jsre) stopMining(call otto.FunctionCall) otto.Value { - self.xeth.Miner().Stop() + self.ethereum.StopMining() return otto.TrueValue() } func (self *jsre) startMining(call otto.FunctionCall) otto.Value { - self.xeth.Miner().Start() + if err := self.ethereum.StartMining(); err != nil { + return otto.FalseValue() + } return otto.TrueValue() } diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 73c67bdc9..0d239f7b4 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -214,7 +214,7 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { utils.StartRPC(eth, ctx) } if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { - eth.Miner().Start() + eth.StartMining() } } -- cgit v1.2.3