core: Prevent local tx:s from being discarded

This commit is contained in:
Martin Holst Swende 2017-06-30 22:55:10 +02:00
parent 67aff49822
commit a633a2d7ea

View File

@ -725,12 +725,14 @@ 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
for _, tx := range list.Cap(int(pool.config.AccountQueue)) { if !pool.locals.containsAddress(addr) {
hash := tx.Hash() for _, tx := range list.Cap(int(pool.config.AccountQueue)) {
delete(pool.all, hash) hash := tx.Hash()
pool.priced.Removed() delete(pool.all, hash)
queuedRateLimitCounter.Inc(1) pool.priced.Removed()
log.Trace("Removed cap-exceeding queued transaction", "hash", hash) queuedRateLimitCounter.Inc(1)
log.Trace("Removed cap-exceeding queued transaction", "hash", hash)
}
} }
queued += uint64(list.Len()) queued += uint64(list.Len())
@ -815,7 +817,10 @@ 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 {
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]}) // Don't drop locals
if !pool.locals.containsAddress(addr) {
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]})
}
} }
sort.Sort(addresses) sort.Sort(addresses)