core/txpool: don't track blobtxs, don't track invalid txs
This commit is contained in:
parent
231a2a5794
commit
8639d5c044
|
@ -70,21 +70,29 @@ func New(journalPath string, journalTime time.Duration, chainConfig *params.Chai
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track adds a transaction to the tracked set.
|
// Track adds a transaction to the tracked set.
|
||||||
|
// Note: blob-type transactions are ignored.
|
||||||
func (tracker *TxTracker) Track(tx *types.Transaction) {
|
func (tracker *TxTracker) Track(tx *types.Transaction) {
|
||||||
tracker.TrackAll([]*types.Transaction{tx})
|
tracker.TrackAll([]*types.Transaction{tx})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrackAll adds a list of transactions to the tracked set.
|
// TrackAll adds a list of transactions to the tracked set.
|
||||||
|
// Note: blob-type transactions are ignored.
|
||||||
func (tracker *TxTracker) TrackAll(txs []*types.Transaction) {
|
func (tracker *TxTracker) TrackAll(txs []*types.Transaction) {
|
||||||
tracker.mu.Lock()
|
tracker.mu.Lock()
|
||||||
defer tracker.mu.Unlock()
|
defer tracker.mu.Unlock()
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
|
if tx.Type() == types.BlobTxType {
|
||||||
|
continue
|
||||||
|
}
|
||||||
// If we're already tracking it, it's a no-op
|
// If we're already tracking it, it's a no-op
|
||||||
if _, ok := tracker.all[tx.Hash()]; ok {
|
if _, ok := tracker.all[tx.Hash()]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tracker.all[tx.Hash()] = tx
|
tracker.all[tx.Hash()] = tx
|
||||||
addr, _ := types.Sender(tracker.signer, tx)
|
addr, err := types.Sender(tracker.signer, tx)
|
||||||
|
if err != nil { // Ignore this tx
|
||||||
|
continue
|
||||||
|
}
|
||||||
if tracker.byAddr[addr] == nil {
|
if tracker.byAddr[addr] == nil {
|
||||||
tracker.byAddr[addr] = legacypool.NewSortedMap()
|
tracker.byAddr[addr] = legacypool.NewSortedMap()
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,6 @@ func (p *TxPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||||
// back the errors into the original sort order.
|
// back the errors into the original sort order.
|
||||||
errsets := make([][]error, len(p.subpools))
|
errsets := make([][]error, len(p.subpools))
|
||||||
for i := 0; i < len(p.subpools); i++ {
|
for i := 0; i < len(p.subpools); i++ {
|
||||||
// Note: local is explicitly set to false here.
|
|
||||||
errsets[i] = p.subpools[i].Add(txsets[i], sync)
|
errsets[i] = p.subpools[i].Add(txsets[i], sync)
|
||||||
}
|
}
|
||||||
errs := make([]error, len(txs))
|
errs := make([]error, len(txs))
|
||||||
|
|
Loading…
Reference in New Issue