diff options
author | Martin Holst Swende <martin@swende.se> | 2017-07-01 04:55:10 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2017-07-01 04:55:10 +0800 |
commit | a633a2d7ea8aadb1d435679449d002de880fab30 (patch) | |
tree | 374b48ebbef77f33c3672e43c98a2441fe442943 /core | |
parent | 67aff49822a411611941e4b93a0343df75fd21b7 (diff) | |
download | go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar.gz go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar.bz2 go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar.lz go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar.xz go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.tar.zst go-tangerine-a633a2d7ea8aadb1d435679449d002de880fab30.zip |
core: Prevent local tx:s from being discarded
Diffstat (limited to 'core')
-rw-r--r-- | core/tx_pool.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index 3f758957a..143689c59 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -725,12 +725,14 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A pool.promoteTx(addr, hash, tx) } // Drop all transactions over the allowed limit - for _, tx := range list.Cap(int(pool.config.AccountQueue)) { - hash := tx.Hash() - delete(pool.all, hash) - pool.priced.Removed() - queuedRateLimitCounter.Inc(1) - log.Trace("Removed cap-exceeding queued transaction", "hash", hash) + if !pool.locals.containsAddress(addr) { + for _, tx := range list.Cap(int(pool.config.AccountQueue)) { + hash := tx.Hash() + delete(pool.all, hash) + pool.priced.Removed() + queuedRateLimitCounter.Inc(1) + log.Trace("Removed cap-exceeding queued transaction", "hash", hash) + } } 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 addresses := make(addresssByHeartbeat, 0, len(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) |