aboutsummaryrefslogtreecommitdiffstats
path: root/core/tx_pool.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-30 19:50:27 +0800
committerGitHub <noreply@github.com>2017-05-30 19:50:27 +0800
commit71814bf6c4382e2538b25653e2b41f4e76c56d0d (patch)
tree382c6647759f4c868bd6d831388612c0abe71631 /core/tx_pool.go
parentb0f30b0b37f2afcf9bf9fb8519abc7ffe595e615 (diff)
parent280609c99bc4daeed179aab75e9ee4c5721b2a9e (diff)
downloaddexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar.gz
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar.bz2
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar.lz
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar.xz
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.tar.zst
dexon-71814bf6c4382e2538b25653e2b41f4e76c56d0d.zip
Merge pull request #14547 from karalabe/txpool-gas-decrease
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)