Optimisations and fixed a couple of DDOS issues in the miner
This commit is contained in:
@ -387,14 +387,11 @@ func (gui *Gui) update() {
|
||||
generalUpdateTicker := time.NewTicker(500 * time.Millisecond)
|
||||
statsUpdateTicker := time.NewTicker(5 * time.Second)
|
||||
|
||||
state := gui.eth.ChainManager().TransState()
|
||||
|
||||
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance())))
|
||||
|
||||
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
|
||||
miningLabel := gui.getObjectByName("miningLabel")
|
||||
|
||||
events := gui.eth.EventMux().Subscribe(
|
||||
core.ChainEvent{},
|
||||
core.TxPreEvent{},
|
||||
core.TxPostEvent{},
|
||||
)
|
||||
@ -407,6 +404,8 @@ func (gui *Gui) update() {
|
||||
return
|
||||
}
|
||||
switch ev := ev.(type) {
|
||||
case core.ChainEvent:
|
||||
gui.processBlock(ev.Block, false)
|
||||
case core.TxPreEvent:
|
||||
gui.insertTransaction("pre", ev.Tx)
|
||||
|
||||
@ -422,19 +421,6 @@ func (gui *Gui) update() {
|
||||
lastBlockLabel.Set("text", statusText)
|
||||
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
|
||||
|
||||
/*
|
||||
blockLength := gui.eth.BlockPool().BlocksProcessed
|
||||
chainLength := gui.eth.BlockPool().ChainLength
|
||||
|
||||
var (
|
||||
pct float64 = 1.0 / float64(chainLength) * float64(blockLength)
|
||||
dlWidget = gui.win.Root().ObjectByName("downloadIndicator")
|
||||
dlLabel = gui.win.Root().ObjectByName("downloadLabel")
|
||||
)
|
||||
dlWidget.Set("value", pct)
|
||||
dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength))
|
||||
*/
|
||||
|
||||
case <-statsUpdateTicker.C:
|
||||
gui.setStatsPane()
|
||||
}
|
||||
|
Reference in New Issue
Block a user