Skip to content

Commit 24fa872

Browse files
authored
chore: added story protocol support (#95)
1 parent 99d947c commit 24fa872

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

app/app.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ import (
2222
)
2323

2424
type CosmosApp struct {
25-
binaryPath string
26-
isCosmovisor bool
27-
homePath string
28-
chainRest string
25+
binaryPath string
26+
isCosmovisor bool
27+
isStoryProtocol bool
28+
homePath string
29+
chainRest string
2930

3031
cmd *exec.Cmd
3132

@@ -86,6 +87,10 @@ func (app *CosmosApp) IsCosmovisor() bool {
8687
return app.isCosmovisor
8788
}
8889

90+
func (app *CosmosApp) IsStoryProtocol() bool {
91+
return app.isStoryProtocol
92+
}
93+
8994
func (app *CosmosApp) IsReset() bool {
9095
return app.ConsensusEngine.GetHeight() == 0
9196
}
@@ -378,6 +383,7 @@ func (app *CosmosApp) LoadBinaryPath() error {
378383

379384
app.binaryPath = binaryPath
380385
app.isCosmovisor = strings.HasSuffix(binaryPath, "cosmovisor")
386+
app.isStoryProtocol = strings.HasSuffix(binaryPath, "storyd")
381387

382388
logger.Logger.Info().Msgf("loaded cosmos app at path \"%s\" from app binary", binaryPath)
383389
return nil
@@ -461,6 +467,16 @@ func (app *CosmosApp) LoadConsensusEngine() error {
461467
}
462468
}
463469

470+
if app.isStoryProtocol {
471+
engine, err := cometbft_v38.NewEngine(app.homePath)
472+
if err != nil {
473+
return fmt.Errorf("failed to create engine: %w", err)
474+
}
475+
476+
app.ConsensusEngine = engine
477+
return nil
478+
}
479+
464480
// we first try to detect the engine by checking the build dependencies
465481
// in the "version --long" command. If we don't find anything there we check
466482
// the "tendermint version" command. We prefer to detect it with the build

0 commit comments

Comments
 (0)