-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R: Support export at specific height #2792
Changes from 6 commits
7031bc8
d761eb7
f9c7281
241f636
338b49b
795a76d
183c7b2
81ae35c
2b32268
d2a5353
0e56ed9
46b331d
10713e3
3686a3f
267728f
7cb314e
fa5622e
737d024
4a9ce8a
cb40646
1f632e3
6e9c3f8
9118cd7
4b5be08
b1a1f19
2bff5c2
bba7a30
6feab55
addcfbf
7f07e93
45b0e3a
0453992
555b61e
2179567
17b9afa
42402d3
ac0319f
f1d5b80
554bdfb
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 |
---|---|---|
|
@@ -13,9 +13,13 @@ import ( | |
"path" | ||
) | ||
|
||
const ( | ||
flagHeight = "height" | ||
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. This flag also lives in the client package: https://github.com/cosmos/cosmos-sdk/blob/develop/client/flags.go#L23 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. Indeed - I don't know if we want to import the client package from the server package though. Maybe we should have a common "flags" package. |
||
) | ||
|
||
// ExportCmd dumps app state to JSON. | ||
func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.Command { | ||
return &cobra.Command{ | ||
cmd := &cobra.Command{ | ||
Use: "export", | ||
Short: "Export state to JSON", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
@@ -45,7 +49,8 @@ func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.C | |
if err != nil { | ||
return err | ||
} | ||
appState, validators, err := appExporter(ctx.Logger, db, traceWriter) | ||
height := viper.GetInt64(flagHeight) | ||
appState, validators, err := appExporter(ctx.Logger, db, traceWriter, height) | ||
if err != nil { | ||
return errors.Errorf("error exporting state: %v\n", err) | ||
} | ||
|
@@ -67,6 +72,8 @@ func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.C | |
return nil | ||
}, | ||
} | ||
cmd.Flags().Int64(flagHeight, -1, "Export state from a particular height (-1 means latest height)") | ||
return cmd | ||
} | ||
|
||
func isEmptyState(home string) (bool, error) { | ||
|
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.
Likely going to run to a merge conflict here (docs PR)