feat(core): add begin/end block extension interfaces (#14604)

This commit is contained in:
Aaron Craelius 2023-01-13 12:21:57 -05:00 committed by GitHub
parent de17e6e6c5
commit fa7ff32f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
package appmodule
import (
"context"
"cosmossdk.io/depinject"
"google.golang.org/grpc"
)
@ -35,3 +37,23 @@ type HasServices interface {
// do not need to specify this in golang code.
RegisterServices(grpc.ServiceRegistrar)
}
// HasBeginBlocker is the extension interface that modules should implement to run
// custom logic before transaction processing in a block.
type HasBeginBlocker interface {
AppModule
// BeginBlock is a method that will be run before transactions are processed in
// a block.
BeginBlock(context.Context) error
}
// HasEndBlocker is the extension interface that modules should implement to run
// custom logic after transaction processing in a block.
type HasEndBlocker interface {
AppModule
// EndBlock is a method that will be run after transactions are processed in
// a block.
EndBlock(context.Context) error
}