Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
This commit is contained in:
parent
552f18a961
commit
77f1ef7c90
@ -786,10 +786,11 @@ func (app *BaseApp) internalFinalizeBlock(ctx context.Context, req *abci.Finaliz
|
||||
WithHeaderHash(req.Hash))
|
||||
}
|
||||
|
||||
if err := app.preBlock(req); err != nil {
|
||||
preblockEvents, err := app.preBlock(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
events = append(events, app.finalizeBlockState.ctx.EventManager().ABCIEvents()...)
|
||||
events = append(events, preblockEvents...)
|
||||
|
||||
beginBlock, err := app.beginBlock(req)
|
||||
if err != nil {
|
||||
|
||||
@ -704,11 +704,12 @@ func (app *BaseApp) cacheTxContext(ctx sdk.Context, txBytes []byte) (sdk.Context
|
||||
return ctx.WithMultiStore(msCache), msCache
|
||||
}
|
||||
|
||||
func (app *BaseApp) preBlock(req *abci.FinalizeBlockRequest) error {
|
||||
func (app *BaseApp) preBlock(req *abci.FinalizeBlockRequest) ([]abci.Event, error) {
|
||||
var events []abci.Event
|
||||
if app.preBlocker != nil {
|
||||
ctx := app.finalizeBlockState.Context()
|
||||
if err := app.preBlocker(ctx, req); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
// ConsensusParams can change in preblocker, so we need to
|
||||
// write the consensus parameters in store to context
|
||||
@ -717,8 +718,9 @@ func (app *BaseApp) preBlock(req *abci.FinalizeBlockRequest) error {
|
||||
gasMeter := app.getBlockGasMeter(ctx)
|
||||
ctx = ctx.WithBlockGasMeter(gasMeter)
|
||||
app.finalizeBlockState.SetContext(ctx)
|
||||
events = ctx.EventManager().ABCIEvents()
|
||||
}
|
||||
return nil
|
||||
return events, nil
|
||||
}
|
||||
|
||||
func (app *BaseApp) beginBlock(_ *abci.FinalizeBlockRequest) (sdk.BeginBlock, error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user