diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index bf2885b1db9..f5da970f56d 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -739,6 +739,7 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re // // Note: If the postHandler fails, we also revert the runMsgs state. if app.postHandler != nil { + // Follow-up Ref: https://github.com/cosmos/cosmos-sdk/pull/13941 newCtx, err := app.postHandler(runMsgCtx, tx, result, mode == runTxModeSimulate, err == nil) if err != nil { return gInfo, nil, nil, priority, err diff --git a/types/handler.go b/types/handler.go index 8175bfc6022..fe441eada3a 100644 --- a/types/handler.go +++ b/types/handler.go @@ -7,7 +7,8 @@ type Handler func(ctx Context, msg Msg) (*Result, error) // If newCtx.IsZero(), ctx is used instead. type AnteHandler func(ctx Context, tx Tx, simulate bool) (newCtx Context, err error) -// PostHandler +// PostHandler like AnteHandler but it executes after RunMsgs. Runs on success +// or failure and enables use cases like gas refunding. type PostHandler func(ctx Context, tx Tx, res *Result, simulate, success bool) (newCtx Context, err error) // AnteDecorator wraps the next AnteHandler to perform custom pre-processing.