Set(Begin/End)Blocker and some comments
This commit is contained in:
parent
b2a12628c7
commit
5019700425
|
@ -87,6 +87,12 @@ func (app *BaseApp) SetTxDecoder(txDecoder sdk.TxDecoder) {
|
||||||
func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer) {
|
func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer) {
|
||||||
app.initChainer = 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) {
|
func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) {
|
||||||
// deducts fee from payer, verifies signatures and nonces, sets Signers to ctx.
|
// deducts fee from payer, verifies signatures and nonces, sets Signers to ctx.
|
||||||
app.anteHandler = ah
|
app.anteHandler = ah
|
||||||
|
@ -95,11 +101,6 @@ func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) {
|
||||||
// nolint - Get functions
|
// nolint - Get functions
|
||||||
func (app *BaseApp) Router() Router { return app.router }
|
func (app *BaseApp) Router() Router { return app.router }
|
||||||
|
|
||||||
/* TODO consider:
|
|
||||||
func (app *BaseApp) SetBeginBlocker(...) {}
|
|
||||||
func (app *BaseApp) SetEndBlocker(...) {}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// load latest application version
|
// load latest application version
|
||||||
func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error {
|
func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error {
|
||||||
app.cms.LoadLatestVersion()
|
app.cms.LoadLatestVersion()
|
||||||
|
|
|
@ -80,8 +80,8 @@ func MakeTxCodec() *wire.Codec {
|
||||||
// custom logic for transaction decoding
|
// custom logic for transaction decoding
|
||||||
func (app *BasecoinApp) txDecoder(txBytes []byte) (sdk.Tx, sdk.Error) {
|
func (app *BasecoinApp) txDecoder(txBytes []byte) (sdk.Tx, sdk.Error) {
|
||||||
var tx = sdk.StdTx{}
|
var tx = sdk.StdTx{}
|
||||||
// StdTx.Msg is an interface whose concrete
|
// StdTx.Msg is an interface. The concrete types
|
||||||
// types are registered in app/msgs.go.
|
// are registered by MakeTxCodec in bank.RegisterWire.
|
||||||
err := app.cdc.UnmarshalBinary(txBytes, &tx)
|
err := app.cdc.UnmarshalBinary(txBytes, &tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sdk.ErrTxParse("").TraceCause(err, "")
|
return nil, sdk.ErrTxParse("").TraceCause(err, "")
|
||||||
|
|
|
@ -5,8 +5,8 @@ import abci "github.com/tendermint/abci/types"
|
||||||
// initialize application state at genesis
|
// initialize application state at genesis
|
||||||
type InitChainer func(ctx Context, req abci.RequestInitChain) abci.ResponseInitChain
|
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
|
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
|
type EndBlocker func(ctx Context, req abci.RequestEndBlock) abci.ResponseEndBlock
|
||||||
|
|
Loading…
Reference in New Issue