mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
core/txpool: clear completed, return nil error in Flush function
This commit is contained in:
parent
75466ac520
commit
474a027d27
1 changed files with 7 additions and 9 deletions
|
|
@ -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
|
||||
// and errors for any that failed add.
|
||||
// and corresponding errors (nil on success) for each attempted insert.
|
||||
func (b *BlobBuffer) Flush() ([]common.Hash, []error) {
|
||||
var errs []error
|
||||
var txs []common.Hash
|
||||
for _, ptx := range b.completed {
|
||||
if err := b.addToPool(ptx); err != nil {
|
||||
errs = append(errs, err)
|
||||
txs = append(txs, ptx.Tx.Hash())
|
||||
}
|
||||
txs := make([]common.Hash, len(b.completed))
|
||||
errs := make([]error, len(b.completed))
|
||||
for i, ptx := range b.completed {
|
||||
txs[i] = ptx.Tx.Hash()
|
||||
errs[i] = b.addToPool(ptx)
|
||||
}
|
||||
|
||||
b.completed = nil
|
||||
return txs, errs
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue