aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-17 19:24:51 +0800
committerobscuren <geffobscura@gmail.com>2015-02-17 19:24:58 +0800
commit8135752a32837748e6d4a986912131736b1a0aa0 (patch)
tree0ad3b6abab8a4b0c013844f93ca665526d2a567a /cmd
parent164de5e22be39ba2bdc58f84f72572252634e7e1 (diff)
downloadgo-tangerine-8135752a32837748e6d4a986912131736b1a0aa0.tar.gz
go-tangerine-8135752a32837748e6d4a986912131736b1a0aa0.tar.zst
go-tangerine-8135752a32837748e6d4a986912131736b1a0aa0.zip
"centralised" mining to backend. Closes #323
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mist/ext_app.go2
-rw-r--r--cmd/mist/gui.go5
-rw-r--r--cmd/mist/ui_lib.go14
3 files changed, 7 insertions, 14 deletions
diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go
index 4831884e5..7ac51db0b 100644
--- a/cmd/mist/ext_app.go
+++ b/cmd/mist/ext_app.go
@@ -43,7 +43,7 @@ type AppContainer interface {
type ExtApplication struct {
*xeth.XEth
- eth core.EthManager
+ eth core.Backend
events event.Subscription
watcherQuitChan chan bool
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 208b553d2..9ce6ba650 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -41,7 +41,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
@@ -81,8 +80,6 @@ type Gui struct {
config *ethutil.ConfigManager
plugins map[string]plugin
-
- miner *miner.Miner
}
// Create GUI, but doesn't start it
@@ -454,7 +451,7 @@ func (gui *Gui) update() {
case <-generalUpdateTicker.C:
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String()
lastBlockLabel.Set("text", statusText)
- miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.HashRate(), 10)+"/Khash")
+ miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
/*
blockLength := gui.eth.BlockPool().BlocksProcessed
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go
index 368fb002b..1a4d21012 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -30,7 +30,6 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/javascript"
- "github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
)
@@ -56,13 +55,10 @@ type UiLib struct {
filterCallbacks map[int][]int
filterManager *filter.FilterManager
-
- miner *miner.Miner
}
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
lib := &UiLib{XEth: xeth.New(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)}
- lib.miner = miner.New(eth.KeyManager().Address(), eth)
lib.filterManager = filter.NewFilterManager(eth.EventMux())
go lib.filterManager.Start()
@@ -221,20 +217,20 @@ func (self *UiLib) RemoveLocalTransaction(id int) {
}
func (self *UiLib) SetGasPrice(price string) {
- self.miner.MinAcceptedGasPrice = ethutil.Big(price)
+ self.Miner().MinAcceptedGasPrice = ethutil.Big(price)
}
func (self *UiLib) SetExtra(extra string) {
- self.miner.Extra = extra
+ self.Miner().Extra = extra
}
func (self *UiLib) ToggleMining() bool {
- if !self.miner.Mining() {
- self.miner.Start()
+ if !self.Miner().Mining() {
+ self.Miner().Start()
return true
} else {
- self.miner.Stop()
+ self.Miner().Stop()
return false
}