From 097646e6dfac43dc1fc4f638d75993257f4955cb Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Wed, 9 May 2018 21:57:30 +0200 Subject: [PATCH] Correct semantics for simulateDeliver --- baseapp/baseapp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 32ee0eec6d..a6e2dfdf2a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -378,7 +378,7 @@ func (app *BaseApp) Deliver(tx sdk.Tx) (result sdk.Result) { // txBytes may be nil in some cases, eg. in tests. // Also, in the future we may support "internal" transactions. -func (app *BaseApp) runTx(isCheckTx bool, fullRun bool, txBytes []byte, tx sdk.Tx) (result sdk.Result) { +func (app *BaseApp) runTx(isCheckTx bool, simulateDeliver bool, txBytes []byte, tx sdk.Tx) (result sdk.Result) { // Handle any panics. defer func() { if r := recover(); r != nil { @@ -418,7 +418,7 @@ func (app *BaseApp) runTx(isCheckTx bool, fullRun bool, txBytes []byte, tx sdk.T ctx = ctx.WithGasMeter(sdk.NewGasMeter(app.txGasLimit)) // Simulate a DeliverTx for gas calculation - if isCheckTx && fullRun { + if isCheckTx && simulateDeliver { ctx = ctx.WithIsCheckTx(false) } @@ -457,8 +457,8 @@ func (app *BaseApp) runTx(isCheckTx bool, fullRun bool, txBytes []byte, tx sdk.T // Set gas utilized result.GasUsed = ctx.GasMeter().GasConsumed() - // If result was successful, write to app.checkState.ms or app.deliverState.ms - if result.IsOK() { + // If not a simulated run and result was successful, write to app.checkState.ms or app.deliverState.ms + if !simulateDeliver && result.IsOK() { msCache.Write() }