-
Notifications
You must be signed in to change notification settings - Fork 69
core/txpool: remove use of errors.Join function #27523 #1914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Comment on lines
+101
to
+102
|
||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // loop is the transaction pool's main event loop, waiting for and reacting to | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message "subpool close errors" is misleading because the errs slice can also contain an error from the quit channel (line 92-94), which is not a subpool close error. Consider using a more accurate message like "transaction pool close errors" or separately handling and reporting errors from different sources for better diagnostics.