-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix cctp submitter race #2853
fix cctp submitter race #2853
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 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
import ( | ||||||||||||||||||||||||||||||
"context" | ||||||||||||||||||||||||||||||
"errors" | ||||||||||||||||||||||||||||||
"fmt" | ||||||||||||||||||||||||||||||
"math/big" | ||||||||||||||||||||||||||||||
"sync" | ||||||||||||||||||||||||||||||
|
@@ -237,9 +238,12 @@ | |||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
g.Go(func() error { | ||||||||||||||||||||||||||||||
err := r.submitter.Start(ctx) | ||||||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||||||
return fmt.Errorf("could not start submitter: %w", err) | ||||||||||||||||||||||||||||||
if !r.submitter.Started() { | ||||||||||||||||||||||||||||||
err := r.submitter.Start(ctx) | ||||||||||||||||||||||||||||||
if err != nil && !errors.Is(err, submitter.ErrSubmitterAlreadyStarted) { | ||||||||||||||||||||||||||||||
return fmt.Errorf("could not start submitter: %w", err) | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
return nil | ||||||||||||||||||||||||||||||
Comment on lines
+241
to
+246
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error Handling Improvement: Check if submitter has already started. The added check ensures that the transaction submitter is not started multiple times, preventing redundant operations and potential errors. However, the conditional block can be simplified for better readability. - if !r.submitter.Started() {
- err := r.submitter.Start(ctx)
- if err != nil && !errors.Is(err, submitter.ErrSubmitterAlreadyStarted) {
- return fmt.Errorf("could not start submitter: %w", err)
- }
- return nil
- }
+ if r.submitter.Started() {
+ return nil
+ }
+ err := r.submitter.Start(ctx)
+ if err != nil && !errors.Is(err, submitter.ErrSubmitterAlreadyStarted) {
+ return fmt.Errorf("could not start submitter: %w", err)
+ }
+ return nil Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
return nil | ||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
|
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.
Error Handling Improvement: Check if txSubmitter has already started.
The added check ensures that the transaction submitter is not started multiple times, preventing redundant operations and potential errors. However, the conditional block can be simplified for better readability.
Committable suggestion