diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-30 23:13:12 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-30 23:13:12 +0800 |
commit | da7828f336cb323c78810d2963f8353787c03077 (patch) | |
tree | a282912029059394193d437a1979075f9ccfc73a /ethereal/ui | |
parent | c5481b7654b8ab35b2242befc3a5b235e6d70685 (diff) | |
download | dexon-da7828f336cb323c78810d2963f8353787c03077.tar dexon-da7828f336cb323c78810d2963f8353787c03077.tar.gz dexon-da7828f336cb323c78810d2963f8353787c03077.tar.bz2 dexon-da7828f336cb323c78810d2963f8353787c03077.tar.lz dexon-da7828f336cb323c78810d2963f8353787c03077.tar.xz dexon-da7828f336cb323c78810d2963f8353787c03077.tar.zst dexon-da7828f336cb323c78810d2963f8353787c03077.zip |
Fixed tx nonce
Diffstat (limited to 'ethereal/ui')
-rw-r--r-- | ethereal/ui/gui.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 8ec09459b..c821fa824 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -146,17 +146,20 @@ func (ui *Gui) update() { account := ui.eth.StateManager().GetAddrState(ui.addr).Object unconfirmedFunds := new(big.Int) ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(account.Amount))) + + addrState := ui.eth.StateManager().GetAddrState(ui.addr) + for { select { case txMsg := <-txChan: tx := txMsg.Tx if txMsg.Type == ethchain.TxPre { - if bytes.Compare(tx.Sender(), ui.addr) == 0 { + if bytes.Compare(tx.Sender(), ui.addr) == 0 && addrState.Nonce <= tx.Nonce { ui.win.Root().Call("addTx", NewQTx(tx)) ui.txDb.Put(tx.Hash(), tx.RlpEncode()) - ui.eth.StateManager().GetAddrState(ui.addr).Nonce += 1 + addrState.Nonce += 1 unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) } else if bytes.Compare(tx.Recipient, ui.addr) == 0 { ui.win.Root().Call("addTx", NewQTx(tx)) |