Skip to content

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Aug 15, 2024
1 parent 64872ae commit f118e8e
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions mod/runtime/pkg/cosmos/baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ func (app *BaseApp) MountStore(
// LoadLatestVersion loads the latest application version. It will panic if
// called more than once on a running BaseApp.
func (app *BaseApp) LoadLatestVersion() error {
err := app.cms.LoadLatestVersion()
if err != nil {
if err := app.cms.LoadLatestVersion(); err != nil {
return fmt.Errorf("failed to load latest version: %w", err)
}

return app.Init()
// Validator pruning settings.
return app.cms.GetPruning().Validate()
}

// CommitMultiStore returns the root multi-store.
Expand All @@ -223,7 +223,8 @@ func (app *BaseApp) LoadVersion(version int64) error {
return fmt.Errorf("failed to load version %d: %w", version, err)
}

return app.Init()
// Validate Pruning settings.
return app.cms.GetPruning().Validate()
}

// LastCommitID returns the last CommitID of the multistore.
Expand All @@ -236,18 +237,6 @@ func (app *BaseApp) LastBlockHeight() int64 {
return app.cms.LastCommitID().Version
}

// Init initializes the app. It seals the app, preventing any
// further modifications. In addition, it validates the app against
// the earlier provided settings. Returns an error if validation fails.
// nil otherwise. Panics if the app is already sealed.
func (app *BaseApp) Init() error {
if app.cms == nil {
return errors.New("commit multi-store must not be nil")
}

return app.cms.GetPruning().Validate()
}

func (app *BaseApp) setMinRetainBlocks(minRetainBlocks uint64) {
app.minRetainBlocks = minRetainBlocks
}
Expand Down

0 comments on commit f118e8e

Please sign in to comment.