Skip to content

Commit

Permalink
chore: correctly use default engine (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler authored Jun 24, 2024
1 parent 2661a1d commit fcab3a1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cmd/ksync/commands/blocksync.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func init() {
blockSyncCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
blockSyncCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

blockSyncCmd.Flags().StringVarP(&binaryPath, "binary", "b", "", "binary path of node to be synced")
if err := blockSyncCmd.MarkFlagRequired("binary"); err != nil {
Expand Down Expand Up @@ -76,7 +76,7 @@ var blockSyncCmd = &cobra.Command{
return
}

defaultEngine := engines.EngineFactory(utils.DefaultEngine)
defaultEngine := engines.EngineFactory(engine)
if reset {
if err := defaultEngine.ResetAll(homePath, true); err != nil {
logger.Error().Msg(fmt.Sprintf("failed to reset tendermint application: %s", err))
Expand Down
4 changes: 2 additions & 2 deletions cmd/ksync/commands/heightsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func init() {
heightSyncCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
heightSyncCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

heightSyncCmd.Flags().StringVarP(&binaryPath, "binary", "b", "", "binary path of node to be synced")
if err := heightSyncCmd.MarkFlagRequired("binary"); err != nil {
Expand Down Expand Up @@ -61,7 +61,7 @@ var heightSyncCmd = &cobra.Command{
os.Exit(1)
}

defaultEngine := engines.EngineFactory(utils.DefaultEngine)
defaultEngine := engines.EngineFactory(engine)
if reset {
if err := defaultEngine.ResetAll(homePath, true); err != nil {
logger.Error().Msg(fmt.Sprintf("failed to reset tendermint application: %s", err))
Expand Down
2 changes: 1 addition & 1 deletion cmd/ksync/commands/resetall.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func init() {
resetCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
resetCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

resetCmd.Flags().StringVar(&homePath, "home", "", "home directory")
if err := resetCmd.MarkFlagRequired("home"); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/ksync/commands/serveblocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func init() {
serveBlocksCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
serveBlocksCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

serveBlocksCmd.Flags().StringVarP(&binaryPath, "binary", "b", "", "binary path of node to be synced")
if err := serveBlocksCmd.MarkFlagRequired("binary"); err != nil {
Expand Down Expand Up @@ -67,7 +67,7 @@ var serveBlocksCmd = &cobra.Command{
return
}

defaultEngine := engines.EngineFactory(utils.DefaultEngine)
defaultEngine := engines.EngineFactory(engine)
if reset {
if err := defaultEngine.ResetAll(homePath, true); err != nil {
logger.Error().Msg(fmt.Sprintf("failed to reset tendermint application: %s", err))
Expand Down
5 changes: 2 additions & 3 deletions cmd/ksync/commands/servesnapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func init() {
servesnapshotsCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
servesnapshotsCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

servesnapshotsCmd.Flags().StringVarP(&binaryPath, "binary", "b", "", "binary path of node to be synced")
if err := servesnapshotsCmd.MarkFlagRequired("binary"); err != nil {
Expand Down Expand Up @@ -73,8 +73,7 @@ var servesnapshotsCmd = &cobra.Command{
os.Exit(1)
}

// always use the newest engine as default version since they are backwards compatible
defaultEngine := engines.EngineFactory(utils.DefaultEngine)
defaultEngine := engines.EngineFactory(engine)
if reset {
if err := defaultEngine.ResetAll(homePath, true); err != nil {
logger.Error().Msg(fmt.Sprintf("failed to reset tendermint application: %s", err))
Expand Down
4 changes: 2 additions & 2 deletions cmd/ksync/commands/statesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func init() {
stateSyncCmd.Flags().StringVarP(&engine, "engine", "e", "", fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))
stateSyncCmd.Flags().StringVarP(&engine, "engine", "e", utils.DefaultEngine, fmt.Sprintf("consensus engine of the binary by default %s is used, list all engines with \"ksync engines\"", utils.DefaultEngine))

stateSyncCmd.Flags().StringVarP(&binaryPath, "binary", "b", "", "binary path of node to be synced")
if err := stateSyncCmd.MarkFlagRequired("binary"); err != nil {
Expand Down Expand Up @@ -59,7 +59,7 @@ var stateSyncCmd = &cobra.Command{
os.Exit(1)
}

defaultEngine := engines.EngineFactory(utils.DefaultEngine)
defaultEngine := engines.EngineFactory(engine)
if reset {
if err := defaultEngine.ResetAll(homePath, true); err != nil {
logger.Error().Msg(fmt.Sprintf("failed to reset tendermint application: %s", err))
Expand Down

0 comments on commit fcab3a1

Please sign in to comment.