From 1affc1c08d921c2ac70cee9d0a88d3cc378fa947 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 20 Jun 2023 13:51:59 +0200 Subject: [PATCH] core/txpool: remove use of errors.Join function (#27523) his function was added in Go 1.20, but our compatibility target is Go 1.19. --- core/txpool/txpool.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index f2c94563b..24105babc 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -17,7 +17,7 @@ package txpool import ( - "errors" + "fmt" "math/big" "github.com/ethereum/go-ethereum/common" @@ -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