Skip to content

Commit

Permalink
Removed mined transactions from pending view. Closes #321
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Feb 17, 2015
1 parent 26d58e0 commit c1474e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmd/mist/assets/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ ApplicationWindow {
}

function setWalletValue(value) {
walletValueLabel.text = value
//walletValueLabel.text = value
}

function loadPlugin(name) {
Expand Down
9 changes: 9 additions & 0 deletions cmd/mist/assets/qml/views/pending_tx.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,13 @@ Rectangle {

pendingTxModel.insert(0, {hash: tx.hash, to: tx.address, from: tx.sender, value: tx.value, contract: isContract})
}

function removeTx(tx) {
for (var i = 0; i < pendingTxModel.count; i++) {
if (tx.hash === pendingTxModel.get(i).hash) {
pendingTxModel.remove(i);
break;
}
}
}
}
28 changes: 2 additions & 26 deletions cmd/mist/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,34 +407,10 @@ func (gui *Gui) update() {
}
switch ev := ev.(type) {
case core.TxPreEvent:
tx := ev.Tx

tstate := gui.eth.ChainManager().TransState()
cstate := gui.eth.ChainManager().State()

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)
gui.insertTransaction("pre", ev.Tx)

case core.TxPostEvent:
tx := ev.Tx
object := state.GetAccount(gui.address())

if bytes.Compare(tx.From(), gui.address()) == 0 {
object.SubAmount(tx.Value())

gui.txDb.Put(tx.Hash(), tx.RlpEncode())
} else if bytes.Compare(tx.To(), gui.address()) == 0 {
object.AddAmount(tx.Value())

gui.txDb.Put(tx.Hash(), tx.RlpEncode())
}

gui.setWalletValue(object.Balance(), nil)
state.UpdateStateObject(object)
gui.getObjectByName("pendingTxView").Call("removeTx", xeth.NewTx(ev.Tx))
}

case <-peerUpdateTicker.C:
Expand Down

0 comments on commit c1474e1

Please sign in to comment.