Skip to content

Commit 57faa86

Browse files
committed
Abort OE in PrepareProposal
1 parent 649319c commit 57faa86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

baseapp/abci.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,14 @@ func (app *BaseApp) PrepareProposal(req *abci.RequestPrepareProposal) (resp *abc
403403
return nil, errors.New("PrepareProposal handler not set")
404404
}
405405

406+
// Abort any running OE so it cannot overlap with `PrepareProposal`. This could happen if optimistic
407+
// `internalFinalizeBlock` from previous round takes a long time, but consensus has moved on to next round.
408+
// Overlap is undesirable, since `internalFinalizeBlock` and `PrepareProoposal` could share access to
409+
// in-memory structs depending on application implementation.
410+
// No-op if OE is not enabled.
411+
// Similar call to Abort() is done in `ProcessProposal`.
412+
app.optimisticExec.Abort()
413+
406414
// Always reset state given that PrepareProposal can timeout and be called
407415
// again in a subsequent round.
408416
header := cmtproto.Header{

0 commit comments

Comments
 (0)