aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/gui.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-07 19:18:48 +0800
committerobscuren <geffobscura@gmail.com>2014-11-07 19:18:48 +0800
commit429dd2a100f3b9e2b612b59bcb48f79a805cd6f9 (patch)
treec91fee673e461a192d4d783193c8ddbead4a97d2 /cmd/mist/gui.go
parent48488017e498916c81122c01cfe1880afdd00d48 (diff)
downloaddexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.gz
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.zst
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.zip
Implemented new miner w/ ui interface for merged mining. Closes #177
* Miner has been rewritten * Added new miner pane * Added option for local txs * Added option to read from MergeMining contract and list them for merged mining
Diffstat (limited to 'cmd/mist/gui.go')
-rw-r--r--cmd/mist/gui.go51
1 files changed, 38 insertions, 13 deletions
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 5af1b5c7b..295011244 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -272,8 +272,6 @@ type address struct {
func (gui *Gui) loadAddressBook() {
view := gui.getObjectByName("infoView")
- view.Call("clearAddress")
-
nameReg := gui.pipe.World().Config().Get("NameReg")
if nameReg != nil {
nameReg.EachStorage(func(name string, value *ethutil.Value) {
@@ -286,6 +284,28 @@ func (gui *Gui) loadAddressBook() {
}
}
+func (self *Gui) loadMergedMiningOptions() {
+ view := self.getObjectByName("mergedMiningModel")
+
+ nameReg := self.pipe.World().Config().Get("MergeMining")
+ if nameReg != nil {
+ i := 0
+ nameReg.EachStorage(func(name string, value *ethutil.Value) {
+ if name[0] != 0 {
+ value.Decode()
+
+ view.Call("addMergedMiningOption", struct {
+ Checked bool
+ Name, Address string
+ Id, ItemId int
+ }{false, name, ethutil.Bytes2Hex(value.Bytes()), 0, i})
+
+ i++
+ }
+ })
+ }
+}
+
func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) {
pipe := xeth.New(gui.eth)
nameReg := pipe.World().Config().Get("NameReg")
@@ -382,6 +402,7 @@ func (gui *Gui) update() {
go func() {
go gui.setInitialChainManager()
gui.loadAddressBook()
+ gui.loadMergedMiningOptions()
gui.setPeerInfo()
gui.readPreviousTransactions()
}()
@@ -410,7 +431,6 @@ func (gui *Gui) update() {
chain.NewBlockEvent{},
chain.TxPreEvent{},
chain.TxPostEvent{},
- miner.Event{},
)
// nameReg := gui.pipe.World().Config().Get("NameReg")
@@ -469,12 +489,14 @@ func (gui *Gui) update() {
case eth.PeerListEvent:
gui.setPeerInfo()
- case miner.Event:
- if ev.Type == miner.Started {
- gui.miner = ev.Miner
- } else {
- gui.miner = nil
- }
+ /*
+ case miner.Event:
+ if ev.Type == miner.Started {
+ gui.miner = ev.Miner
+ } else {
+ gui.miner = nil
+ }
+ */
}
case <-peerUpdateTicker.C:
@@ -483,10 +505,13 @@ func (gui *Gui) update() {
statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String()
lastBlockLabel.Set("text", statusText)
- if gui.miner != nil {
- pow := gui.miner.GetPow()
- miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
- }
+ miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash")
+ /*
+ if gui.miner != nil {
+ pow := gui.miner.GetPow()
+ miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
+ }
+ */
blockLength := gui.eth.BlockPool().BlocksProcessed
chainLength := gui.eth.BlockPool().ChainLength