Skip to content

Commit

Permalink
address some comments while reviewing Jaes work
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski committed Nov 22, 2018
1 parent 972377c commit b4b61b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (app *BaseApp) MountStore(key sdk.StoreKey, typ sdk.StoreType) {
}

// load latest application version
// panics if called more than once on a running baseapp
func (app *BaseApp) LoadLatestVersion(mainKey *sdk.KVStoreKey) error {
err := app.cms.LoadLatestVersion()
if err != nil {
Expand All @@ -145,6 +146,7 @@ func (app *BaseApp) LoadLatestVersion(mainKey *sdk.KVStoreKey) error {
}

// load application version
// panics if called more than once on a running baseapp
func (app *BaseApp) LoadVersion(version int64, mainKey *sdk.KVStoreKey) error {
err := app.cms.LoadVersion(version)
if err != nil {
Expand Down Expand Up @@ -702,7 +704,9 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk
}
}

// consume block gas whether panic or not.
// If BlockGasMeter() panics it will be caught by the above recover and
// return an error - in any case BlockGasMeter will consume gas past
// the limit.
if mode == runTxModeDeliver {
ctx.BlockGasMeter().ConsumeGas(
ctx.GasMeter().GasConsumedToLimit(), "block gas meter")
Expand Down
2 changes: 1 addition & 1 deletion types/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (g *basicGasMeter) Limit() Gas {
}

func (g *basicGasMeter) GasConsumedToLimit() Gas {
if g.consumed > g.limit {
if g.IsPastLimit() {
return g.limit
}
return g.consumed
Expand Down

0 comments on commit b4b61b8

Please sign in to comment.