mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
Simplify Service/Reactor pattern
This commit is contained in:
@@ -49,15 +49,17 @@ func NewConsensusReactor(consensusState *ConsensusState, blockStore *bc.BlockSto
|
||||
return conR
|
||||
}
|
||||
|
||||
func (conR *ConsensusReactor) AfterStart() {
|
||||
func (conR *ConsensusReactor) OnStart() {
|
||||
log.Notice("ConsensusReactor ", "fastSync", conR.fastSync)
|
||||
conR.BaseReactor.OnStart()
|
||||
if !conR.fastSync {
|
||||
conR.conS.Start()
|
||||
}
|
||||
go conR.broadcastNewRoundStepRoutine()
|
||||
}
|
||||
|
||||
func (conR *ConsensusReactor) AfterStop() {
|
||||
func (conR *ConsensusReactor) OnStop() {
|
||||
conR.BaseReactor.OnStop()
|
||||
conR.conS.Stop()
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -360,12 +360,14 @@ func (cs *ConsensusState) NewStepCh() chan *RoundState {
|
||||
return cs.newStepCh
|
||||
}
|
||||
|
||||
func (cs *ConsensusState) AfterStart() {
|
||||
func (cs *ConsensusState) OnStart() {
|
||||
cs.BaseService.OnStart()
|
||||
cs.scheduleRound0(cs.Height)
|
||||
}
|
||||
|
||||
func (cs *ConsensusState) AfterStop() {
|
||||
func (cs *ConsensusState) OnStop() {
|
||||
// It's mostly asynchronous so, there's not much to stop.
|
||||
cs.BaseService.OnStop()
|
||||
}
|
||||
|
||||
// EnterNewRound(height, 0) at cs.StartTime.
|
||||
|
||||
Reference in New Issue
Block a user