diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-04 23:44:43 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-04 23:44:43 +0800 |
commit | a5b27bbc10d6a145152fc2629043c46ef4a9ca71 (patch) | |
tree | 9752704f0f3f310f382d75438d2c71ff73fbe16c /cmd/mist/gui.go | |
parent | 8c7e4b290fbdfe2c0da451aef03b94bec3c95e4c (diff) | |
download | dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar.gz dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar.bz2 dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar.lz dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar.xz dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.tar.zst dexon-a5b27bbc10d6a145152fc2629043c46ef4a9ca71.zip |
Improved and simplified wallet functions and behaviour
Diffstat (limited to 'cmd/mist/gui.go')
-rw-r--r-- | cmd/mist/gui.go | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e58e349d1..6a28b48f9 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -404,7 +404,6 @@ func (gui *Gui) update() { state := gui.eth.BlockManager().TransState() - unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) lastBlockLabel := gui.getObjectByName("lastBlockLabel") @@ -438,15 +437,15 @@ func (gui *Gui) update() { case core.TxPreEvent: tx := ev.Tx - object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - unconfirmedFunds.Add(unconfirmedFunds, tx.Value) - } + tstate := gui.eth.BlockManager().TransState() + cstate := gui.eth.BlockManager().CurrentState() - gui.setWalletValue(object.Balance(), unconfirmedFunds) + taccount := tstate.GetAccount(gui.address()) + caccount := cstate.GetAccount(gui.address()) + unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance()) + + gui.setWalletValue(taccount.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) case core.TxPostEvent: @@ -456,32 +455,18 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { object.SubAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { object.AddAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } gui.setWalletValue(object.Balance(), nil) state.UpdateStateObject(object) - // case object: - // gui.loadAddressBook() - case eth.PeerListEvent: gui.setPeerInfo() - - /* - case miner.Event: - if ev.Type == miner.Started { - gui.miner = ev.Miner - } else { - gui.miner = nil - } - */ } case <-peerUpdateTicker.C: |