aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-15 03:34:30 +0800
committerobscuren <geffobscura@gmail.com>2014-05-15 03:34:30 +0800
commit6efdd21633c1d21f36080754a89ad82c0c244128 (patch)
tree873da7787044997e5590d35e32076ecb7a21dae4 /ethchain/transaction_pool.go
parent283f4d8eb3e223f89fd613767e1c6c318ac2bb75 (diff)
parentad4ffdc9474aca48ab1d3d361797398f795a6d31 (diff)
downloaddexon-6efdd21633c1d21f36080754a89ad82c0c244128.tar.gz
dexon-6efdd21633c1d21f36080754a89ad82c0c244128.tar.zst
dexon-6efdd21633c1d21f36080754a89ad82c0c244128.zip
Merge branch 'release/poc5-rc6'
Diffstat (limited to 'ethchain/transaction_pool.go')
-rw-r--r--ethchain/transaction_pool.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index 56deae0c6..6c0282dc6 100644
--- a/ethchain/transaction_pool.go
+++ b/ethchain/transaction_pool.go
@@ -210,9 +210,9 @@ func (pool *TxPool) CurrentTransactions() []*Transaction {
txList := make([]*Transaction, pool.pool.Len())
i := 0
for e := pool.pool.Front(); e != nil; e = e.Next() {
- if tx, ok := e.Value.(*Transaction); ok {
- txList[i] = tx
- }
+ tx := e.Value.(*Transaction)
+
+ txList[i] = tx
i++
}
@@ -220,6 +220,17 @@ func (pool *TxPool) CurrentTransactions() []*Transaction {
return txList
}
+func (pool *TxPool) RemoveInvalid(state *State) {
+ for e := pool.pool.Front(); e != nil; e = e.Next() {
+ tx := e.Value.(*Transaction)
+ sender := state.GetAccount(tx.Sender())
+ err := pool.ValidateTransaction(tx)
+ if err != nil || sender.Nonce != tx.Nonce {
+ pool.pool.Remove(e)
+ }
+ }
+}
+
func (pool *TxPool) Flush() []*Transaction {
txList := pool.CurrentTransactions()