diff --git a/cmd/ksync/commands/blocksync.go b/cmd/ksync/commands/blocksync.go index f649326..864cc8b 100644 --- a/cmd/ksync/commands/blocksync.go +++ b/cmd/ksync/commands/blocksync.go @@ -82,11 +82,6 @@ var blockSyncCmd = &cobra.Command{ logger.Info().Msgf("loaded source \"%s\" from genesis file", source) } - if engine == "" && binaryPath != "" { - engine = utils.GetEnginePathFromBinary(binaryPath) - logger.Info().Msgf("loaded engine \"%s\" from binary path", engine) - } - bId, _, err := sources.GetPoolIds(chainId, source, blockPoolId, "", registryUrl, true, false) if err != nil { return fmt.Errorf("failed to load pool-ids: %w", err) @@ -131,6 +126,11 @@ var blockSyncCmd = &cobra.Command{ return fmt.Errorf("failed to check if binary has the recommended version: %w", err) } + if engine == "" && binaryPath != "" { + engine = utils.GetEnginePathFromBinary(binaryPath) + logger.Info().Msgf("loaded engine \"%s\" from binary path", engine) + } + consensusEngine, err := engines.EngineSourceFactory(engine, homePath, registryUrl, source, rpcServerPort, continuationHeight) if err != nil { return fmt.Errorf("failed to create consensus engine for source: %w", err) diff --git a/cmd/ksync/commands/heightsync.go b/cmd/ksync/commands/heightsync.go index 56231ea..b455f32 100644 --- a/cmd/ksync/commands/heightsync.go +++ b/cmd/ksync/commands/heightsync.go @@ -65,11 +65,6 @@ var heightSyncCmd = &cobra.Command{ homePath = utils.GetHomePathFromBinary(binaryPath) } - if engine == "" && binaryPath != "" { - engine = utils.GetEnginePathFromBinary(binaryPath) - logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) - } - defaultEngine := engines.EngineFactory(engine, homePath, rpcServerPort) if source == "" && blockPoolId == "" && snapshotPoolId == "" { @@ -140,6 +135,11 @@ var heightSyncCmd = &cobra.Command{ return fmt.Errorf("failed to check if binary has the recommended version: %w", err) } + if engine == "" && binaryPath != "" { + engine = utils.GetEnginePathFromBinary(binaryPath) + logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) + } + consensusEngine, err := engines.EngineSourceFactory(engine, homePath, registryUrl, source, rpcServerPort, continuationHeight) if err != nil { return fmt.Errorf("failed to create consensus engine for source: %w", err) diff --git a/cmd/ksync/commands/serveblocks.go b/cmd/ksync/commands/serveblocks.go index d600881..2126d6d 100644 --- a/cmd/ksync/commands/serveblocks.go +++ b/cmd/ksync/commands/serveblocks.go @@ -65,11 +65,6 @@ var serveBlocksCmd = &cobra.Command{ homePath = utils.GetHomePathFromBinary(binaryPath) } - if engine == "" && binaryPath != "" { - engine = utils.GetEnginePathFromBinary(binaryPath) - logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) - } - defaultEngine := engines.EngineFactory(engine, homePath, rpcServerPort) if source == "" && blockPoolId == "" { @@ -120,6 +115,11 @@ var serveBlocksCmd = &cobra.Command{ return fmt.Errorf("failed to check if binary has the recommended version: %w", err) } + if engine == "" && binaryPath != "" { + engine = utils.GetEnginePathFromBinary(binaryPath) + logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) + } + consensusEngine, err := engines.EngineSourceFactory(engine, homePath, registryUrl, source, rpcServerPort, continuationHeight) if err != nil { return fmt.Errorf("failed to create consensus engine for source: %w", err) diff --git a/cmd/ksync/commands/servesnapshots.go b/cmd/ksync/commands/servesnapshots.go index 6750f33..7143b59 100644 --- a/cmd/ksync/commands/servesnapshots.go +++ b/cmd/ksync/commands/servesnapshots.go @@ -66,11 +66,6 @@ var servesnapshotsCmd = &cobra.Command{ homePath = utils.GetHomePathFromBinary(binaryPath) } - if engine == "" && binaryPath != "" { - engine = utils.GetEnginePathFromBinary(binaryPath) - logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) - } - defaultEngine := engines.EngineFactory(engine, homePath, rpcServerPort) if source == "" && blockPoolId == "" && snapshotPoolId == "" { @@ -133,6 +128,11 @@ var servesnapshotsCmd = &cobra.Command{ return fmt.Errorf("failed to check if binary has the recommended version: %w", err) } + if engine == "" && binaryPath != "" { + engine = utils.GetEnginePathFromBinary(binaryPath) + logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) + } + consensusEngine, err := engines.EngineSourceFactory(engine, homePath, registryUrl, source, rpcServerPort, continuationHeight) if err != nil { return fmt.Errorf("failed to create consensus engine for source: %w", err) diff --git a/cmd/ksync/commands/statesync.go b/cmd/ksync/commands/statesync.go index 7546a6f..6d10f1c 100644 --- a/cmd/ksync/commands/statesync.go +++ b/cmd/ksync/commands/statesync.go @@ -62,11 +62,6 @@ var stateSyncCmd = &cobra.Command{ homePath = utils.GetHomePathFromBinary(binaryPath) } - if engine == "" && binaryPath != "" { - engine = utils.GetEnginePathFromBinary(binaryPath) - logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) - } - defaultEngine := engines.EngineFactory(engine, homePath, rpcServerPort) if source == "" && snapshotPoolId == "" { @@ -105,6 +100,11 @@ var stateSyncCmd = &cobra.Command{ return fmt.Errorf("failed to check if binary has the recommended version: %w", err) } + if engine == "" && binaryPath != "" { + engine = utils.GetEnginePathFromBinary(binaryPath) + logger.Info().Msgf("Loaded engine \"%s\" from binary path", engine) + } + consensusEngine, err := engines.EngineSourceFactory(engine, homePath, registryUrl, source, rpcServerPort, snapshotHeight) if err != nil { return fmt.Errorf("failed to create consensus engine for source: %w", err)