mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
txpool: smaller lock portion
This commit is contained in:
parent
8bd64f4a1c
commit
47fd824ebd
1 changed files with 4 additions and 5 deletions
|
|
@ -803,18 +803,17 @@ func (pool *TxPool) addTxsLocked(txs []*types.Transaction, local bool) ([]error,
|
|||
// Status returns the status (unknown/pending/queued) of a batch of transactions
|
||||
// identified by their hashes.
|
||||
func (pool *TxPool) Status(hashes []common.Hash) []TxStatus {
|
||||
pool.mu.RLock()
|
||||
defer pool.mu.RUnlock()
|
||||
|
||||
status := make([]TxStatus, len(hashes))
|
||||
for i, hash := range hashes {
|
||||
if tx := pool.all.Get(hash); tx != nil {
|
||||
if tx := pool.Get(hash); tx != nil {
|
||||
from, _ := types.Sender(pool.signer, tx) // already validated
|
||||
if pool.pending[from] != nil && pool.pending[from].txs.items[tx.Nonce()] != nil {
|
||||
pool.mu.RLock()
|
||||
if txList := pool.pending[from]; txList != nil && txList.txs.items[tx.Nonce()] != nil {
|
||||
status[i] = TxStatusPending
|
||||
} else {
|
||||
status[i] = TxStatusQueued
|
||||
}
|
||||
pool.mu.RUnlock()
|
||||
}
|
||||
}
|
||||
return status
|
||||
|
|
|
|||
Loading…
Reference in a new issue