Skip to content

Commit

Permalink
go/consensus/cometbft: Support application extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Jan 30, 2024
1 parent 7900c68 commit 8225aca
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions go/consensus/cometbft/api/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,26 @@ type Application interface {
// Commit is omitted because Applications will work on a cache of
// the state bound to the multiplexer.
}

// Extension is the interface implemented by application-specific extensions.
type Extension interface {
// Methods returns the list of supported methods.
Methods() []transaction.MethodName

// OnRegister is the function that is called when the Application
// is registered with the multiplexer instance.
OnRegister(ApplicationState, MessageDispatcher)

// ExecuteTx executes a transaction.
ExecuteTx(*Context, *transaction.Transaction) error

// BeginBlock signals the beginning of a block.
//
// Note: Errors are irrecoverable and will result in a panic.
BeginBlock(*Context) error

// EndBlock signals the end of a block.
//
// Note: Errors are irrecoverable and will result in a panic.
EndBlock(*Context) error
}

0 comments on commit 8225aca

Please sign in to comment.