aboutsummaryrefslogtreecommitdiffstats
path: root/core/tx_pool.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-30 05:31:37 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-30 05:31:37 +0800
commit280609c99bc4daeed179aab75e9ee4c5721b2a9e (patch)
tree909cf4b6433c37e33a5564e15861ad632bf3b9f5 /core/tx_pool.go
parentdd06c8584368316c8fb388384b0723d8c7e543f0 (diff)
downloaddexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar.gz
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar.bz2
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar.lz
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar.xz
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.tar.zst
dexon-280609c99bc4daeed179aab75e9ee4c5721b2a9e.zip
core: check for gas limit exceeding txs too on new block
Diffstat (limited to 'core/tx_pool.go')
-rw-r--r--core/tx_pool.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go
index 7aea02101..1f5b46d4b 100644
--- a/core/tx_pool.go
+++ b/core/tx_pool.go
@@ -663,6 +663,8 @@ func (pool *TxPool) removeTx(hash common.Hash) {
// future queue to the set of pending transactions. During this process, all
// invalidated transactions (low nonce, low balance) are deleted.
func (pool *TxPool) promoteExecutables(state *state.StateDB) {
+ gaslimit := pool.gasLimit()
+
// Iterate over all accounts and promote any executable transactions
queued := uint64(0)
for addr, list := range pool.queue {
@@ -673,8 +675,8 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB) {
delete(pool.all, hash)
pool.priced.Removed()
}
- // Drop all transactions that are too costly (low balance)
- drops, _ := list.Filter(state.GetBalance(addr))
+ // Drop all transactions that are too costly (low balance or out of gas)
+ drops, _ := list.Filter(state.GetBalance(addr), gaslimit)
for _, tx := range drops {
hash := tx.Hash()
log.Trace("Removed unpayable queued transaction", "hash", hash)
@@ -798,6 +800,8 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB) {
// executable/pending queue and any subsequent transactions that become unexecutable
// are moved back into the future queue.
func (pool *TxPool) demoteUnexecutables(state *state.StateDB) {
+ gaslimit := pool.gasLimit()
+
// Iterate over all accounts and demote any non-executable transactions
for addr, list := range pool.pending {
nonce := state.GetNonce(addr)
@@ -809,8 +813,8 @@ func (pool *TxPool) demoteUnexecutables(state *state.StateDB) {
delete(pool.all, hash)
pool.priced.Removed()
}
- // Drop all transactions that are too costly (low balance), and queue any invalids back for later
- drops, invalids := list.Filter(state.GetBalance(addr))
+ // Drop all transactions that are too costly (low balance or out of gas), and queue any invalids back for later
+ drops, invalids := list.Filter(state.GetBalance(addr), gaslimit)
for _, tx := range drops {
hash := tx.Hash()
log.Trace("Removed unpayable pending transaction", "hash", hash)