// SwitchToConsensus switches from block-sync mode to consensus mode. It resets
// the state, turns off block-sync, and starts the consensus state-machine.
SwitchToConsensus switches from block-sync mode to consensus mode. It resets
the state, turns off block-sync, and starts the consensus state-machine.
// SwitchToConsensus switches from block - sync mode to consensus mode . It resets // the state turns off block - sync and starts the consensus state - machine .
func (r *Reactor) SwitchToConsensus(state sm.State, skipWAL bool) {
	r.Logger.Info("switching to consensus")
	if state.LastBlockHeight > 0 {
		r.state.reconstructLastCommit(state)
	}
	r.state.updateToState(state)
	r.mtx.Lock()
	r.waitSync = false
	r.mtx.Unlock()
	r.Metrics.BlockSyncing.Set(0)
	r.Metrics.StateSyncing.Set(0)
	if skipWAL {
		r.state.doWALCatchup = false
	}
	if err := r.state.Start(); err != nil {
		panic(fmt.Sprintf(`failed to start consensus state: %v
conS:
%+v
conR:
%+v`, err, r.state, r))
	}
	d := types.EventDataBlockSyncStatus{Complete: true, Height: state.LastBlockHeight}
	if err := r.eventBus.PublishEventBlockSyncStatus(d); err != nil {
		r.Logger.Error("failed to emit the blocksync complete event", "err", err)
	}
}
func ( r * Reactor ) SwitchToConsensus ( state sm . State , skipWAL bool ) { r . Logger . Info ( " " ) if state . LastBlockHeight > 0 { r . state . reconstructLastCommit ( state ) } r . state . updateToState ( state ) r . mtx . Lock ( ) r . waitSync = false r . mtx . Unlock ( ) r . Metrics . BlockSyncing . Set ( 0 ) r . Metrics . StateSyncing . Set ( 0 ) if skipWAL { r . state . doWALCatchup = false } if err := r . state . Start ( ) ; err != nil { panic ( fmt . Sprintf ( `failed to start consensus state: %v

conS:
%+v

conR:
%+v` , err , r . state , r ) ) } d := types . EventDataBlockSyncStatus { Complete : true , Height : state . LastBlockHeight } if err := r . eventBus . PublishEventBlockSyncStatus ( d ) ; err != nil { r . Logger . Error ( " " , " " , err ) } }
SwitchToConsensus switches from block-sync mode to consensus mode.
SwitchToConsensus switches from block - sync mode to consensus mode .
// we have no votes, so reconstruct LastCommit from SeenCommit // NOTE: The line below causes broadcastNewRoundStepRoutine() to broadcast a // NewRoundStepMessage.