aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-15 20:06:06 +0800
committerobscuren <geffobscura@gmail.com>2014-05-15 20:06:06 +0800
commit3a2bddc160ece4dcb6d2d5bcc85091d244e774c0 (patch)
tree022f99696d0e8481fab9a4110151a98d7ee04333
parent9ba3c6d1af106af782ffa68a586a1600e02974d9 (diff)
downloadgo-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar.gz
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar.bz2
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar.lz
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar.xz
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.tar.zst
go-tangerine-3a2bddc160ece4dcb6d2d5bcc85091d244e774c0.zip
Refactored to reactor. Fixes #42
-rw-r--r--ethereal/ui/gui.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index aa0364998..c4cc1373f 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -178,13 +178,14 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
// Simple go routine function that updates the list of peers in the GUI
func (gui *Gui) update() {
- blockChan := make(chan ethutil.React, 1)
reactor := gui.eth.Reactor()
- reactor.Subscribe("newBlock", blockChan)
+ blockChan := make(chan ethutil.React, 1)
+ txChan := make(chan ethutil.React, 1)
- txChan := make(chan ethchain.TxMsg, 1)
- gui.eth.TxPool().Subscribe(txChan)
+ reactor.Subscribe("newBlock", blockChan)
+ reactor.Subscribe("newTx:pre", txChan)
+ reactor.Subscribe("newTx:post", txChan)
state := gui.eth.StateManager().TransState()
@@ -200,9 +201,9 @@ func (gui *Gui) update() {
}
case txMsg := <-txChan:
- tx := txMsg.Tx
+ tx := txMsg.Resource.(*ethchain.Transaction)
- if txMsg.Type == ethchain.TxPre {
+ if txMsg.Event == "newTx:pre" {
object := state.GetAccount(gui.addr)
if bytes.Compare(tx.Sender(), gui.addr) == 0 && object.Nonce <= tx.Nonce {