Skip to content

Commit

Permalink
fixed invalied chainID abled into txpool
Browse files Browse the repository at this point in the history
  • Loading branch information
ttblack committed Jul 25, 2021
1 parent adbc306 commit 0527169
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,16 +823,22 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
knownTxMeter.Mark(1)
continue
}
// Exclude transactions with invalid signatures as soon as
// possible and cache senders in transactions before
// obtaining lock
_, err := types.Sender(pool.signer, tx)
if err != nil {
errs[i] = ErrInvalidSender
invalidTxMeter.Mark(1)
continue
}
// Accumulate all unknown transactions for deeper processing
news = append(news, tx)
}
if len(news) == 0 {
return errs
}
// Cache senders in transactions before obtaining lock (pool.signer is immutable)
for _, tx := range news {
types.Sender(pool.signer, tx)
}

// Process all the new transaction and merge any errors into the original slice
pool.mu.Lock()
newErrs, dirtyAddrs := pool.addTxsLocked(news, local)
Expand All @@ -844,6 +850,7 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
nilSlot++
}
errs[nilSlot] = err
nilSlot++
}
// Reorg the pool internals if needed and return
done := pool.requestPromoteExecutables(dirtyAddrs)
Expand Down

0 comments on commit 0527169

Please sign in to comment.