From a7050de4f3f1860605c0dc9cf9406df86378ffd0 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Tue, 13 Jan 2026 19:21:57 +0800 Subject: [PATCH] core/txpool: remove use of errors.Join function #27523 (#1914) --- core/txpool/txpool.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 109b626b00..c4f2804833 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -17,7 +17,7 @@ package txpool import ( - "errors" + "fmt" "maps" "math/big" @@ -89,13 +89,19 @@ 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