@@ -29,7 +29,9 @@ func GetDumpSnapshotCmd() *cobra.Command {
2929 var cmd = & cobra.Command {
3030 Use : "dump-snapshot [node_home]" ,
3131 Short : "Dump snapshot from node, using Cosmos-SDK snapshot commands" ,
32- Args : cobra .ExactArgs (1 ),
32+ Long : "Dump snapshot from node, using Cosmos-SDK snapshot commands.\n " +
33+ "The node will be stopped, data will be exported, dumped and restore into another node home directory (eg ~/.gaia → ~/.gaia-dump)." ,
34+ Args : cobra .ExactArgs (1 ),
3335 Run : func (cmd * cobra.Command , args []string ) {
3436 utils .MustNotUserRoot ()
3537
@@ -78,7 +80,7 @@ func GetDumpSnapshotCmd() *cobra.Command {
7880
7981 if err := validateBinary (binary ); err != nil {
8082 utils .PrintlnStdErr ("ERR: invalid binary path:" , err )
81- utils .PrintlnStdErr ("ERR: correct flag --%s\n " , flagBinary )
83+ utils .PrintfStdErr ("ERR: correct flag --%s\n " , flagBinary )
8284 exitWithError = true
8385 return
8486 }
@@ -298,8 +300,15 @@ func GetDumpSnapshotCmd() *cobra.Command {
298300 exitWithError = true
299301 return
300302 }
301- externalRpcs , _ := cmd .Flags ().GetStringSlice (flagExternalRpc )
302- rpcEps := append (externalRpcs , rpc )
303+ externalRPCs , _ := cmd .Flags ().GetStringSlice (flagExternalRpc )
304+ rpcEps := []string {rpc }
305+ for _ , externalRPC := range externalRPCs {
306+ rpc := strings .TrimSpace (externalRPC )
307+ if rpc == "" {
308+ continue
309+ }
310+ rpcEps = append (rpcEps , rpc )
311+ }
303312
304313 for {
305314 resp , err := http .Get (fmt .Sprintf ("%s/status" , strings .TrimSuffix (rpc , "/" )))
@@ -325,7 +334,11 @@ func GetDumpSnapshotCmd() *cobra.Command {
325334 output , ec := utils .LaunchAppAndGetOutput (
326335 "/bin/bash" ,
327336 []string {
328- "-c" , fmt .Sprintf (`curl -m 30 -s "%s/block?height=%d" | jq -r .result.block_id.hash` , rpc , mostRecentSnapshot .height ),
337+ "-c" , fmt .Sprintf (
338+ `curl -m 30 -s "%s/block?height=%d" | jq -r .result.block_id.hash` ,
339+ rpc ,
340+ mostRecentSnapshot .height ,
341+ ),
329342 },
330343 )
331344 if ec != 0 {
@@ -349,7 +362,7 @@ func GetDumpSnapshotCmd() *cobra.Command {
349362 continue
350363 }
351364 if trustHash != "" {
352- // ignore
365+ // take the first valid trust hash
353366 continue
354367 }
355368 trustHash = resTrustHash
@@ -403,7 +416,7 @@ func GetDumpSnapshotCmd() *cobra.Command {
403416 cmd .Flags ().String (flagServiceName , "" , "Custom service name, used to call start/stop" )
404417 cmd .Flags ().StringSlice (flagExternalRpc , []string {}, "External RPC address used for bootstrapping node" )
405418 cmd .Flags ().Bool (flagXCrisisSkipAssertInvariants , false , "Skip assert invariants" )
406- cmd .Flags ().Bool (flagFixGenesis , false , "Fix genesis `initial_height`" )
419+ cmd .Flags ().Bool (flagFixGenesis , false , "Fix `initial_height` in genesis.json " )
407420
408421 return cmd
409422}
0 commit comments