-
Notifications
You must be signed in to change notification settings - Fork 221
refactor: bump go-header and use DeleteRange method for rollback #2638
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 |
---|---|---|
|
@@ -100,11 +100,11 @@ func NewRollbackCmd() *cobra.Command { | |
} | ||
defer dataStore.Stop(goCtx) | ||
|
||
if err := headerStore.DeleteTo(goCtx, height); err != nil { | ||
if err := headerStore.DeleteRange(goCtx, height+1, headerStore.Height()); err != nil { | ||
return fmt.Errorf("failed to rollback header sync service state: %w", err) | ||
} | ||
|
||
if err := dataStore.DeleteTo(goCtx, height); err != nil { | ||
if err := dataStore.DeleteRange(goCtx, height+1, dataStore.Height()); err != nil { | ||
return fmt.Errorf("failed to rollback data sync service state: %w", err) | ||
} | ||
Comment on lines
+103
to
109
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. There are a couple of points to address in this block:
For example, you could define a generic function: func rollbackStore[H header.Header[H]](ctx context.Context, store header.Store[H], height uint64, name string) error {
if err := store.DeleteRange(ctx, height+1, store.Height()); err != nil {
return fmt.Errorf("failed to rollback %s state: %w", name, err)
}
return nil
} |
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.