Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/KYVENetwork/ksync/engines/celestia-core-v34"
"github.com/KYVENetwork/ksync/engines/cometbft-v37"
"github.com/KYVENetwork/ksync/engines/cometbft-v38"
"github.com/KYVENetwork/ksync/engines/dydx-cometbft"
"github.com/KYVENetwork/ksync/engines/tendermint-v34"
"github.com/KYVENetwork/ksync/flags"
"github.com/KYVENetwork/ksync/logger"
Expand Down Expand Up @@ -463,7 +464,7 @@ func (app *CosmosApp) LoadChainRest() (err error) {
return nil
}

func (app *CosmosApp) LoadConsensusEngine() error {
func (app *CosmosApp) LoadConsensusEngine() (err error) {
// if there is already a consensus engine running we close the dbs
// before loading a new one
if app.ConsensusEngine != nil {
Expand All @@ -472,6 +473,32 @@ func (app *CosmosApp) LoadConsensusEngine() error {
}
}

if flags.Engine != "" {
app.ConsensusEngine, err = func() (types.Engine, error) {
switch flags.Engine {
case utils.EngineCelestiaCoreV34:
return celestia_core_v34.NewEngine(app.homePath)
case utils.EngineTendermintV34:
return tendermint_v34.NewEngine(app.homePath)
case utils.EngineCometBFTV37:
return cometbft_v37.NewEngine(app.homePath)
case utils.EngineCometBFTV38:
return cometbft_v38.NewEngine(app.homePath)
case utils.EngineDydxCometBFT:
return dydx_cometbft.NewEngine(app.homePath)
default:
return nil, fmt.Errorf("failed to load consensus engine from flag --engine \"%s\"", flags.Engine)
}
}()

if err != nil {
return err
}

logger.Logger.Info().Msgf("loaded consensus engine \"%s\" from engine flag", app.ConsensusEngine.GetName())
return nil
}

if app.isStoryProtocol {
engine, err := cometbft_v38.NewEngine(app.homePath)
if err != nil {
Expand Down
Loading