core/txpool: clear completed, return nil error in Flush function

This commit is contained in:
healthykim 2026-05-21 15:32:15 +02:00
parent 75466ac520
commit 474a027d27

View file

@ -84,17 +84,15 @@ func NewBlobBuffer(validateTx func(*types.Transaction) error, addToPool func(*Bl
} }
// Flush adds all completed entries to the pool and returns the hashes // Flush adds all completed entries to the pool and returns the hashes
// and errors for any that failed add. // and corresponding errors (nil on success) for each attempted insert.
func (b *BlobBuffer) Flush() ([]common.Hash, []error) { func (b *BlobBuffer) Flush() ([]common.Hash, []error) {
var errs []error txs := make([]common.Hash, len(b.completed))
var txs []common.Hash errs := make([]error, len(b.completed))
for _, ptx := range b.completed { for i, ptx := range b.completed {
if err := b.addToPool(ptx); err != nil { txs[i] = ptx.Tx.Hash()
errs = append(errs, err) errs[i] = b.addToPool(ptx)
txs = append(txs, ptx.Tx.Hash())
}
} }
b.completed = nil
return txs, errs return txs, errs
} }