From bc89c06feb984c6bc6b9ebf453f9db24b6794b74 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 21 Nov 2023 11:50:46 +0100 Subject: [PATCH] feat: only update the app version when at 0 (#361) --- baseapp/abci.go | 4 ++-- baseapp/options.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index eb5971a5bf5..50f5032aa5c 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -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) diff --git a/baseapp/options.go b/baseapp/options.go index b3d4c20fb6c..ba29aa977f3 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -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) {