feat: add core and api for PreBlock (#17468)

This commit is contained in:
mmsqe
2023-08-20 17:05:44 +00:00
committed by GitHub
parent 4e11394a30
commit 1bd37053e0
4 changed files with 188 additions and 28 deletions
+16
View File
@@ -52,6 +52,22 @@ type HasPrecommit interface {
Precommit(context.Context) error
}
// ResponsePreBlock represents the response from the PreBlock method.
// It can modify consensus parameters in storage and signal the caller through the return value.
// When it returns ConsensusParamsChanged=true, the caller must refresh the consensus parameter in the finalize context.
// The new context (ctx) must be passed to all the other lifecycle methods.
type ResponsePreBlock interface {
IsConsensusParamsChanged() bool
}
// HasPreBlocker is the extension interface that modules should implement to run
// custom logic before BeginBlock.
type HasPreBlocker interface {
AppModule
// PreBlock is method that will be run before BeginBlock.
PreBlock(context.Context) (ResponsePreBlock, error)
}
// HasBeginBlocker is the extension interface that modules should implement to run
// custom logic before transaction processing in a block.
type HasBeginBlocker interface {