|
|
@ -115,10 +115,13 @@ type ConsensusState struct { |
|
|
|
// synchronous pubsub between consensus state and reactor.
|
|
|
|
// state only emits EventNewRoundStep, EventVote and EventProposalHeartbeat
|
|
|
|
evsw tmevents.EventSwitch |
|
|
|
|
|
|
|
// for reporting metrics
|
|
|
|
metrics *Metrics |
|
|
|
} |
|
|
|
|
|
|
|
// NewConsensusState returns a new ConsensusState.
|
|
|
|
func NewConsensusState(config *cfg.ConsensusConfig, state sm.State, blockExec *sm.BlockExecutor, blockStore sm.BlockStore, mempool sm.Mempool, evpool sm.EvidencePool) *ConsensusState { |
|
|
|
func NewConsensusState(config *cfg.ConsensusConfig, state sm.State, blockExec *sm.BlockExecutor, blockStore sm.BlockStore, mempool sm.Mempool, evpool sm.EvidencePool, metrics *Metrics) *ConsensusState { |
|
|
|
cs := &ConsensusState{ |
|
|
|
config: config, |
|
|
|
blockExec: blockExec, |
|
|
@ -132,6 +135,7 @@ func NewConsensusState(config *cfg.ConsensusConfig, state sm.State, blockExec *s |
|
|
|
wal: nilWAL{}, |
|
|
|
evpool: evpool, |
|
|
|
evsw: tmevents.NewEventSwitch(), |
|
|
|
metrics: metrics, |
|
|
|
} |
|
|
|
// set function defaults (may be overwritten before calling Start)
|
|
|
|
cs.decideProposal = cs.defaultDecideProposal |
|
|
@ -388,6 +392,7 @@ func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *t |
|
|
|
|
|
|
|
func (cs *ConsensusState) updateHeight(height int64) { |
|
|
|
cs.Height = height |
|
|
|
cs.metrics.Height.Add(float64(height - cs.Height)) |
|
|
|
} |
|
|
|
|
|
|
|
func (cs *ConsensusState) updateRoundStep(round int, step cstypes.RoundStepType) { |
|
|
|