Skip to content

Commit

Permalink
feat(core): add begin/end block extension interfaces (#14604)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Jan 13, 2023
1 parent de17e6e commit fa7ff32
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core/appmodule/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package appmodule

import (
"context"

"cosmossdk.io/depinject"
"google.golang.org/grpc"
)
Expand Down Expand Up @@ -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
}

0 comments on commit fa7ff32

Please sign in to comment.