diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 88ce56e50..cf86e3f7a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -87,6 +87,12 @@ func (app *BaseApp) SetTxDecoder(txDecoder sdk.TxDecoder) { func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer) { app.initChainer = initChainer } +func (app *BaseApp) SetBeginBlocker(beginBlocker sdk.BeginBlocker) { + app.beginBlocker = beginBlocker +} +func (app *BaseApp) SetEndBlocker(endBlocker sdk.EndBlocker) { + app.endBlocker = endBlocker +} func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) { // deducts fee from payer, verifies signatures and nonces, sets Signers to ctx. app.anteHandler = ah @@ -95,11 +101,6 @@ func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) { // nolint - Get functions func (app *BaseApp) Router() Router { return app.router } -/* TODO consider: -func (app *BaseApp) SetBeginBlocker(...) {} -func (app *BaseApp) SetEndBlocker(...) {} -*/ - // load latest application version func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error { app.cms.LoadLatestVersion() diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index b2c26addb..58c25dda8 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -80,8 +80,8 @@ func MakeTxCodec() *wire.Codec { // custom logic for transaction decoding func (app *BasecoinApp) txDecoder(txBytes []byte) (sdk.Tx, sdk.Error) { var tx = sdk.StdTx{} - // StdTx.Msg is an interface whose concrete - // types are registered in app/msgs.go. + // StdTx.Msg is an interface. The concrete types + // are registered by MakeTxCodec in bank.RegisterWire. err := app.cdc.UnmarshalBinary(txBytes, &tx) if err != nil { return nil, sdk.ErrTxParse("").TraceCause(err, "") diff --git a/types/abci.go b/types/abci.go index 8cee24e4e..40651163c 100644 --- a/types/abci.go +++ b/types/abci.go @@ -5,8 +5,8 @@ import abci "github.com/tendermint/abci/types" // initialize application state at genesis type InitChainer func(ctx Context, req abci.RequestInitChain) abci.ResponseInitChain -// +// run code before the transactions in a block type BeginBlocker func(ctx Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock -// +// run code after the transactions in a block and return updates to the validator set type EndBlocker func(ctx Context, req abci.RequestEndBlock) abci.ResponseEndBlock