|
|
@ -408,7 +408,8 @@ func (gui *Gui) update() { |
|
|
|
eth.ChainSyncEvent{}, |
|
|
|
eth.ChainSyncEvent{}, |
|
|
|
eth.PeerListEvent{}, |
|
|
|
eth.PeerListEvent{}, |
|
|
|
ethchain.NewBlockEvent{}, |
|
|
|
ethchain.NewBlockEvent{}, |
|
|
|
ethchain.TxEvent{}, |
|
|
|
ethchain.TxPreEvent{}, |
|
|
|
|
|
|
|
ethchain.TxPostEvent{}, |
|
|
|
ethminer.Event{}, |
|
|
|
ethminer.Event{}, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -430,40 +431,38 @@ func (gui *Gui) update() { |
|
|
|
gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) |
|
|
|
gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case ethchain.TxEvent: |
|
|
|
case ethchain.TxPreEvent: |
|
|
|
tx := ev.Tx |
|
|
|
tx := ev.Tx |
|
|
|
if ev.Type == ethchain.TxPre { |
|
|
|
object := state.GetAccount(gui.address()) |
|
|
|
object := state.GetAccount(gui.address()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if bytes.Compare(tx.Sender(), gui.address()) == 0 { |
|
|
|
if bytes.Compare(tx.Sender(), gui.address()) == 0 { |
|
|
|
unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) |
|
|
|
unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) |
|
|
|
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 { |
|
|
|
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 { |
|
|
|
unconfirmedFunds.Add(unconfirmedFunds, tx.Value) |
|
|
|
unconfirmedFunds.Add(unconfirmedFunds, tx.Value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gui.setWalletValue(object.Balance(), unconfirmedFunds) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui.insertTransaction("pre", tx) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if ev.Type == ethchain.TxPost { |
|
|
|
gui.setWalletValue(object.Balance(), unconfirmedFunds) |
|
|
|
object := state.GetAccount(gui.address()) |
|
|
|
gui.insertTransaction("pre", tx) |
|
|
|
if bytes.Compare(tx.Sender(), gui.address()) == 0 { |
|
|
|
|
|
|
|
object.SubAmount(tx.Value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send")
|
|
|
|
case ethchain.TxPostEvent: |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
tx := ev.Tx |
|
|
|
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 { |
|
|
|
object := state.GetAccount(gui.address()) |
|
|
|
object.AddAmount(tx.Value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv")
|
|
|
|
if bytes.Compare(tx.Sender(), gui.address()) == 0 { |
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
object.SubAmount(tx.Value) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui.setWalletValue(object.Balance(), nil) |
|
|
|
//gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send")
|
|
|
|
|
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
|
|
|
|
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 { |
|
|
|
|
|
|
|
object.AddAmount(tx.Value) |
|
|
|
|
|
|
|
|
|
|
|
state.UpdateStateObject(object) |
|
|
|
//gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv")
|
|
|
|
|
|
|
|
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gui.setWalletValue(object.Balance(), nil) |
|
|
|
|
|
|
|
state.UpdateStateObject(object) |
|
|
|
|
|
|
|
|
|
|
|
// case object:
|
|
|
|
// case object:
|
|
|
|
// gui.loadAddressBook()
|
|
|
|
// gui.loadAddressBook()
|
|
|
|
|
|
|
|
|
|
|
|