From a2fac70aadd37216c37ee14118ac966f8861e3d3 Mon Sep 17 00:00:00 2001 From: chengzhinei Date: Mon, 31 Oct 2022 09:51:24 +0800 Subject: [PATCH] del flag --- consensus/state.go | 10 +++------- state/execution.go | 4 +--- state/execution_context.go | 2 -- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/consensus/state.go b/consensus/state.go index eac6b8a2ec9..a997544d8a2 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -140,9 +140,6 @@ type State struct { // for reporting metrics metrics *Metrics - - // enable the function of pre-run tx or not - prerunTx bool } // StateOption sets an optional parameter on the State. @@ -187,9 +184,8 @@ func NewState( cs.updateToState(state) - if cs.prerunTx { - cs.blockExec.InitPrerun() - } + // init the function of preRun tx + cs.blockExec.InitPrerun() // NOTE: we do not call scheduleRound0 yet, we do that upon Start() @@ -1930,7 +1926,7 @@ func (cs *State) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (add cs.ProposalBlock = block - if cs.prerunTx && cs.Height > cs.state.InitialHeight { + if cs.Height > cs.state.InitialHeight { cs.blockExec.NotifyPrerun(cs.ProposalBlock) } diff --git a/state/execution.go b/state/execution.go index be0c74ee45b..81919dcc99a 100644 --- a/state/execution.go +++ b/state/execution.go @@ -205,9 +205,7 @@ func (blockExec *BlockExecutor) ApplyBlock( var abciResponses *tmstate.ABCIResponses var err error pc := blockExec.prerunCtx - if pc.prerunTx { - abciResponses, err = pc.getPrerunResult(block) - } + abciResponses, err = pc.getPrerunResult(block) if abciResponses == nil { abciResponses, err = execBlockOnProxyApp( blockExec.logger, blockExec.proxyApp, block, blockExec.store, state.InitialHeight, diff --git a/state/execution_context.go b/state/execution_context.go index b623f934363..277c7bf5463 100644 --- a/state/execution_context.go +++ b/state/execution_context.go @@ -9,7 +9,6 @@ import ( ) type prerunContext struct { - prerunTx bool taskChan chan *executionTask taskResultChan chan *executionTask prerunTask *executionTask @@ -45,7 +44,6 @@ func (pc *prerunContext) flushPrerunResult() { } func (pc *prerunContext) prerunRoutine() { - pc.prerunTx = true for task := range pc.taskChan { task.run() }