From 0a05d489bdf1e1d009e09082bba127d344bb5fdb Mon Sep 17 00:00:00 2001 From: chengzhinei Date: Mon, 6 Feb 2023 18:57:02 +0800 Subject: [PATCH] Merge PR: fix swap ws 167 (#2943) * fix swap websocket * fix swap websocket --- libs/tendermint/state/execution.go | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libs/tendermint/state/execution.go b/libs/tendermint/state/execution.go index 94120fd368..5e613a12e1 100644 --- a/libs/tendermint/state/execution.go +++ b/libs/tendermint/state/execution.go @@ -240,16 +240,14 @@ func (blockExec *BlockExecutor) ApplyBlock( abciResponses, duration, err := blockExec.runAbci(block, deltaInfo) - // Events are fired after runAbci. // publish event if types.EnableEventBlockTime { blockExec.FireBlockTimeEvents(block.Height, len(block.Txs), true) - } - // NOTE: if we crash between Commit and Save, events wont be fired during replay - if !blockExec.isNullIndexer { - blockExec.eventsChan <- event{ - block: block, - abciRsp: abciResponses, + if !blockExec.isNullIndexer { + blockExec.eventsChan <- event{ + block: block, + abciRsp: abciResponses, + } } } @@ -316,6 +314,17 @@ func (blockExec *BlockExecutor) ApplyBlock( dc.postApplyBlock(block.Height, deltaInfo, abciResponses, commitResp.DeltaMap, blockExec.isFastSync) + // Events are fired after everything else. + // NOTE: if we crash between Commit and Save, events wont be fired during replay + if !types.EnableEventBlockTime { + if !blockExec.isNullIndexer { + blockExec.eventsChan <- event{ + block: block, + abciRsp: abciResponses, + } + } + } + return state, retainHeight, nil }