From 455da846daed53243e3c20bab69b41e1fc6b61ed Mon Sep 17 00:00:00 2001 From: codchen Date: Mon, 27 Feb 2023 23:52:46 +0800 Subject: [PATCH] Wait for optimistic processing to finish --- app/app.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index d79df9e98f..ba302bcf69 100644 --- a/app/app.go +++ b/app/app.go @@ -982,16 +982,13 @@ func (app *App) FinalizeBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) ctx.Logger().Info(fmt.Sprintf("FinalizeBlock took %dms", duration/time.Millisecond)) }() - if app.optimisticProcessingInfo != nil && !app.optimisticProcessingInfo.Aborted && bytes.Equal(app.optimisticProcessingInfo.Hash, req.Hash) { - select { - case <-app.optimisticProcessingInfo.Completion: + if app.optimisticProcessingInfo != nil { + <-app.optimisticProcessingInfo.Completion + if !app.optimisticProcessingInfo.Aborted && bytes.Equal(app.optimisticProcessingInfo.Hash, req.Hash) { app.SetProcessProposalStateToCommit() appHash := app.WriteStateToCommitAndGetWorkingHash() resp := app.getFinalizeBlockResponse(appHash, app.optimisticProcessingInfo.Events, app.optimisticProcessingInfo.TxRes, app.optimisticProcessingInfo.EndBlockResp) return &resp, nil - case <-time.After(OptimisticProcessingTimeoutInSeconds * time.Second): - ctx.Logger().Info("optimistic processing timed out") - break } } ctx.Logger().Info("optimistic processing ineligible")