Skip to content

Commit c1474e1

Browse files
committed
Removed mined transactions from pending view. Closes #321
1 parent 26d58e0 commit c1474e1

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

cmd/mist/assets/qml/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ ApplicationWindow {
876876
}
877877

878878
function setWalletValue(value) {
879-
walletValueLabel.text = value
879+
//walletValueLabel.text = value
880880
}
881881

882882
function loadPlugin(name) {

cmd/mist/assets/qml/views/pending_tx.qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@ Rectangle {
4141

4242
pendingTxModel.insert(0, {hash: tx.hash, to: tx.address, from: tx.sender, value: tx.value, contract: isContract})
4343
}
44+
45+
function removeTx(tx) {
46+
for (var i = 0; i < pendingTxModel.count; i++) {
47+
if (tx.hash === pendingTxModel.get(i).hash) {
48+
pendingTxModel.remove(i);
49+
break;
50+
}
51+
}
52+
}
4453
}

cmd/mist/gui.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -407,34 +407,10 @@ func (gui *Gui) update() {
407407
}
408408
switch ev := ev.(type) {
409409
case core.TxPreEvent:
410-
tx := ev.Tx
411-
412-
tstate := gui.eth.ChainManager().TransState()
413-
cstate := gui.eth.ChainManager().State()
414-
415-
taccount := tstate.GetAccount(gui.address())
416-
caccount := cstate.GetAccount(gui.address())
417-
unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance())
418-
419-
gui.setWalletValue(taccount.Balance(), unconfirmedFunds)
420-
gui.insertTransaction("pre", tx)
410+
gui.insertTransaction("pre", ev.Tx)
421411

422412
case core.TxPostEvent:
423-
tx := ev.Tx
424-
object := state.GetAccount(gui.address())
425-
426-
if bytes.Compare(tx.From(), gui.address()) == 0 {
427-
object.SubAmount(tx.Value())
428-
429-
gui.txDb.Put(tx.Hash(), tx.RlpEncode())
430-
} else if bytes.Compare(tx.To(), gui.address()) == 0 {
431-
object.AddAmount(tx.Value())
432-
433-
gui.txDb.Put(tx.Hash(), tx.RlpEncode())
434-
}
435-
436-
gui.setWalletValue(object.Balance(), nil)
437-
state.UpdateStateObject(object)
413+
gui.getObjectByName("pendingTxView").Call("removeTx", xeth.NewTx(ev.Tx))
438414
}
439415

440416
case <-peerUpdateTicker.C:

0 commit comments

Comments
 (0)