aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-03-12 06:56:48 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-03-12 06:56:48 +0800
commit6af078bd8c9451f9c12cab371bf7bd2569f575a3 (patch)
tree08d6b802539aadd66fdd27236847de1f966318d2 /cmd
parent5a9f712144058c576d14b0d27ff2d2d270cd6d27 (diff)
parentd5aaf413e0307b07597e48a548f0219f4ea8c3be (diff)
downloadgo-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar.gz
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar.bz2
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar.lz
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar.xz
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.tar.zst
go-tangerine-6af078bd8c9451f9c12cab371bf7bd2569f575a3.zip
Merge pull request #462 from fjl/miner-coinbase
miner: provide coinbase when starting the miner
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/js.go6
-rw-r--r--cmd/ethereum/main.go13
-rw-r--r--cmd/mist/assets/qml/views/miner.qml58
-rw-r--r--cmd/mist/assets/qml/views/network.qml1
-rw-r--r--cmd/mist/ui_lib.go18
5 files changed, 40 insertions, 56 deletions
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..8b01457e6 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -30,7 +30,6 @@ import (
"time"
"github.com/codegangsta/cli"
- "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
@@ -158,10 +157,7 @@ func run(ctx *cli.Context) {
fmt.Printf("Welcome to the FRONTIER\n")
utils.HandleInterrupt()
eth, err := utils.GetEthereum(ClientIdentifier, Version, ctx)
- if err == accounts.ErrNoKeys {
- utils.Fatalf(`No accounts configured.
-Please run 'ethereum account new' to create a new account.`)
- } else if err != nil {
+ if err != nil {
utils.Fatalf("%v", err)
}
@@ -172,10 +168,7 @@ Please run 'ethereum account new' to create a new account.`)
func runjs(ctx *cli.Context) {
eth, err := utils.GetEthereum(ClientIdentifier, Version, ctx)
- if err == accounts.ErrNoKeys {
- utils.Fatalf(`No accounts configured.
-Please run 'ethereum account new' to create a new account.`)
- } else if err != nil {
+ if err != nil {
utils.Fatalf("%v", err)
}
@@ -214,7 +207,7 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
utils.StartRPC(eth, ctx)
}
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) {
- eth.Miner().Start()
+ eth.StartMining()
}
}
diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml
index 4025ff485..ff2bf85ca 100644
--- a/cmd/mist/assets/qml/views/miner.qml
+++ b/cmd/mist/assets/qml/views/miner.qml
@@ -55,8 +55,8 @@ Rectangle {
Button {
text: "Start"
onClicked: {
- eth.setGasPrice(minGasPrice.text || "10000000000000");
- eth.setExtra(blockExtra.text)
+ // eth.setGasPrice(minGasPrice.text || "10000000000000");
+ // eth.setExtra(blockExtra.text)
if (eth.toggleMining()) {
this.text = "Stop";
} else {
@@ -65,35 +65,35 @@ Rectangle {
}
}
- Rectangle {
- id: minGasPriceRect
- anchors.top: parent.top
- anchors.topMargin: 2
- width: 200
- TextField {
- id: minGasPrice
- placeholderText: "Min Gas: 10000000000000"
- width: 200
- validator: RegExpValidator { regExp: /\d*/ }
- }
- }
+ // Rectangle {
+ // id: minGasPriceRect
+ // anchors.top: parent.top
+ // anchors.topMargin: 2
+ // width: 200
+ // TextField {
+ // id: minGasPrice
+ // placeholderText: "Min Gas: 10000000000000"
+ // width: 200
+ // validator: RegExpValidator { regExp: /\d*/ }
+ // }
+ // }
- Rectangle {
- width: 300
- anchors {
- left: minGasPriceRect.right
- leftMargin: 5
- top: parent.top
- topMargin: 2
- }
+ // Rectangle {
+ // width: 300
+ // anchors {
+ // left: minGasPriceRect.right
+ // leftMargin: 5
+ // top: parent.top
+ // topMargin: 2
+ // }
- TextField {
- id: blockExtra
- placeholderText: "Extra"
- width: parent.width
- maximumLength: 1024
- }
- }
+ // TextField {
+ // id: blockExtra
+ // placeholderText: "Extra"
+ // width: parent.width
+ // maximumLength: 1024
+ // }
+ // }
}
}
diff --git a/cmd/mist/assets/qml/views/network.qml b/cmd/mist/assets/qml/views/network.qml
index d33b5773c..fe4c7734f 100644
--- a/cmd/mist/assets/qml/views/network.qml
+++ b/cmd/mist/assets/qml/views/network.qml
@@ -93,7 +93,6 @@ Rectangle {
// Check if it's mining and set it accordingly
if (miningSliderValue > 0 && !eth.miner().mining()) {
// If the
- eth.setGasPrice("10000000000000");
eth.miner().start();
} else if (miningSliderValue == 0 && eth.miner().mining()) {
eth.miner().stop();
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go
index 4198c6316..2679e0f95 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -175,22 +175,12 @@ func (self *UiLib) RemoveLocalTransaction(id int) {
//self.miner.RemoveLocalTx(id)
}
-func (self *UiLib) SetGasPrice(price string) {
- self.Miner().MinAcceptedGasPrice = ethutil.Big(price)
-}
-
-func (self *UiLib) SetExtra(extra string) {
- self.Miner().Extra = extra
-}
-
func (self *UiLib) ToggleMining() bool {
- if !self.Miner().Mining() {
- self.Miner().Start()
-
- return true
+ if !self.eth.IsMining() {
+ err := self.eth.StartMining()
+ return err == nil
} else {
- self.Miner().Stop()
-
+ self.eth.StopMining()
return false
}
}