Commit a633a2d7 authored by Martin Holst Swende's avatar Martin Holst Swende

core: Prevent local tx:s from being discarded

parent 67aff498
...@@ -725,6 +725,7 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A ...@@ -725,6 +725,7 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A
pool.promoteTx(addr, hash, tx) pool.promoteTx(addr, hash, tx)
} }
// Drop all transactions over the allowed limit // Drop all transactions over the allowed limit
if !pool.locals.containsAddress(addr) {
for _, tx := range list.Cap(int(pool.config.AccountQueue)) { for _, tx := range list.Cap(int(pool.config.AccountQueue)) {
hash := tx.Hash() hash := tx.Hash()
delete(pool.all, hash) delete(pool.all, hash)
...@@ -732,6 +733,7 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A ...@@ -732,6 +733,7 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A
queuedRateLimitCounter.Inc(1) queuedRateLimitCounter.Inc(1)
log.Trace("Removed cap-exceeding queued transaction", "hash", hash) log.Trace("Removed cap-exceeding queued transaction", "hash", hash)
} }
}
queued += uint64(list.Len()) queued += uint64(list.Len())
// Delete the entire queue entry if it became empty. // Delete the entire queue entry if it became empty.
...@@ -815,8 +817,11 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A ...@@ -815,8 +817,11 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A
// Sort all accounts with queued transactions by heartbeat // Sort all accounts with queued transactions by heartbeat
addresses := make(addresssByHeartbeat, 0, len(pool.queue)) addresses := make(addresssByHeartbeat, 0, len(pool.queue))
for addr := range pool.queue { for addr := range pool.queue {
// Don't drop locals
if !pool.locals.containsAddress(addr) {
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]}) addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]})
} }
}
sort.Sort(addresses) sort.Sort(addresses)
// Drop transactions until the total is below the limit // Drop transactions until the total is below the limit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment