Skip to content

Commit

Permalink
feat: only update the app version when at 0 (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored Nov 21, 2023
1 parent 18e768c commit bc89c06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOp
// Info implements the ABCI interface.
func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo {
lastCommitID := app.cms.LastCommitID()
// load the app version for a non zero height
if lastCommitID.Version > 0 {
// load the app version for a non zero height and zero app hash
if lastCommitID.Version > 0 && app.appVersion == 0 {
ctx, err := app.createQueryContext(lastCommitID.Version, false)
if err != nil {
panic(err)
Expand Down
8 changes: 4 additions & 4 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ func (app *BaseApp) SetVersion(v string) {
}

// SetAppVersion sets the application's protocol version
func (app *BaseApp) SetAppVersion(ctx sdk.Context, v uint64) {
func (app *BaseApp) SetAppVersion(ctx sdk.Context, version uint64) {
// TODO: could make this less hacky in the future since the SDK
// shouldn't have to know about the app versioning scheme
if ctx.BlockHeader().Version.App >= 2 {
vp := &tmproto.VersionParams{AppVersion: v}
if version >= 2 {
vp := &tmproto.VersionParams{AppVersion: version}
app.paramStore.Set(ctx, ParamStoreKeyVersionParams, vp)
}
app.appVersion = v
app.appVersion = version
}

func (app *BaseApp) SetDB(db dbm.DB) {
Expand Down

0 comments on commit bc89c06

Please sign in to comment.