mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
Refactored to reactor. Fixes #42
This commit is contained in:
parent
9ba3c6d1af
commit
3a2bddc160
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user