diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-06-01 02:29:50 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-06-01 02:29:50 +0800 |
commit | 9702badd83399d62dca4df0cfd65587340def300 (patch) | |
tree | d6414f6dd3a20a13bcf30225ea8d921038e8004e /core | |
parent | 067dc2cbf5121541aea8c6089ac42ce07582ead1 (diff) | |
download | go-tangerine-9702badd83399d62dca4df0cfd65587340def300.tar.gz go-tangerine-9702badd83399d62dca4df0cfd65587340def300.tar.zst go-tangerine-9702badd83399d62dca4df0cfd65587340def300.zip |
core: don't uselessly recheck transactions on dump
Diffstat (limited to 'core')
-rw-r--r-- | core/tx_pool.go | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index 1f5b46d4b..5e399d95f 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -339,17 +339,6 @@ func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) { pool.mu.Lock() defer pool.mu.Unlock() - state, err := pool.currentState() - if err != nil { - return nil, err - } - - // check queue first - pool.promoteExecutables(state) - - // invalidate any txs - pool.demoteUnexecutables(state) - pending := make(map[common.Address]types.Transactions) for addr, list := range pool.pending { pending[addr] = list.Flatten() @@ -551,12 +540,12 @@ func (pool *TxPool) Add(tx *types.Transaction) error { if err != nil { return err } - state, err := pool.currentState() - if err != nil { - return err - } // If we added a new transaction, run promotion checks and return if !replace { + state, err := pool.currentState() + if err != nil { + return err + } pool.promoteExecutables(state) } return nil @@ -579,11 +568,11 @@ func (pool *TxPool) AddBatch(txs []*types.Transaction) error { } // Only reprocess the internal state if something was actually added if added > 0 { - state, err := pool.currentState() - if err != nil { - return err - } if !replaced { + state, err := pool.currentState() + if err != nil { + return err + } pool.promoteExecutables(state) } } |