Skip to content

Commit

Permalink
core/txpool: remove use of errors.Join function (ethereum#27523)
Browse files Browse the repository at this point in the history
his function was added in Go 1.20, but our compatibility target
is Go 1.19.
  • Loading branch information
fjl authored and devopsbo3 committed Nov 10, 2023
1 parent d7a94d9 commit f4ea076
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package txpool

import (
"errors"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -88,13 +88,20 @@ func (p *TxPool) Close() error {
// Terminate the reset loop and wait for it to finish
errc := make(chan error)
p.quit <- errc
errs = append(errs, <-errc)
if err := <-errc; err != nil {
errs = append(errs, err)
}

// Terminate each subpool
for _, subpool := range p.subpools {
errs = append(errs, subpool.Close())
if err := subpool.Close(); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)
if len(errs) > 0 {
return fmt.Errorf("subpool close errors: %v", errs)
}
return nil
}

// loop is the transaction pool's main event loop, waiting for and reacting to
Expand Down

0 comments on commit f4ea076

Please sign in to comment.