diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 17ed869c42..5e3624bb7d 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -264,15 +264,6 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC } res = app.initChainer(app.deliverState.ctx, req) - // add block gas meter - if app.maximumBlockGas > 0 { - app.deliverState.ctx = app.deliverState.ctx. - WithBlockGasMeter(sdk.NewGasMeter(app.maximumBlockGas)) - } else { - app.deliverState.ctx = app.deliverState.ctx. - WithBlockGasMeter(sdk.NewInfiniteGasMeter()) - } - // NOTE: we don't commit, but BeginBlock for block 1 // starts from this deliverState return @@ -443,15 +434,15 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg app.deliverState.ctx = app.deliverState.ctx. WithBlockHeader(req.Header). WithBlockHeight(req.Header.Height) + } - // add block gas meter - if app.maximumBlockGas > 0 { - app.deliverState.ctx = app.deliverState.ctx. - WithBlockGasMeter(sdk.NewGasMeter(app.maximumBlockGas)) - } else { - app.deliverState.ctx = app.deliverState.ctx. - WithBlockGasMeter(sdk.NewInfiniteGasMeter()) - } + // add block gas meter + if app.maximumBlockGas > 0 { + app.deliverState.ctx = app.deliverState.ctx. + WithBlockGasMeter(sdk.NewGasMeter(app.maximumBlockGas)) + } else { + app.deliverState.ctx = app.deliverState.ctx. + WithBlockGasMeter(sdk.NewInfiniteGasMeter()) } if app.beginBlocker != nil { diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 56349ebaa5..6a4bfefcf5 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -491,6 +491,7 @@ func TestDeliverTx(t *testing.T) { } app := setupBaseApp(t, anteOpt, routerOpt) + app.InitChain(abci.RequestInitChain{}) // Create same codec used in txDecoder codec := codec.New()