// subscribeToBroadcastEvents subscribes for new round steps and votes using the
// internal pubsub defined in the consensus state to broadcast them to peers
// upon receiving.
subscribeToBroadcastEvents subscribes for new round steps and votes using the
internal pubsub defined in the consensus state to broadcast them to peers
upon receiving.
// subscribeToBroadcastEvents subscribes for new round steps and votes using the // internal pubsub defined in the consensus state to broadcast them to peers // upon receiving .
func (r *Reactor) subscribeToBroadcastEvents() {
	err := r.state.evsw.AddListenerForEvent(
		listenerIDConsensus,
		types.EventNewRoundStepValue,
		func(data tmevents.EventData) {
			r.broadcastNewRoundStepMessage(data.(*cstypes.RoundState))
			select {
			case r.state.onStopCh <- data.(*cstypes.RoundState):
			default:
			}
		},
	)
	if err != nil {
		r.Logger.Error("failed to add listener for events", "err", err)
	}
	err = r.state.evsw.AddListenerForEvent(
		listenerIDConsensus,
		types.EventValidBlockValue,
		func(data tmevents.EventData) {
			r.broadcastNewValidBlockMessage(data.(*cstypes.RoundState))
		},
	)
	if err != nil {
		r.Logger.Error("failed to add listener for events", "err", err)
	}
	err = r.state.evsw.AddListenerForEvent(
		listenerIDConsensus,
		types.EventVoteValue,
		func(data tmevents.EventData) {
			r.broadcastHasVoteMessage(data.(*types.Vote))
		},
	)
	if err != nil {
		r.Logger.Error("failed to add listener for events", "err", err)
	}
}
func ( r * Reactor ) subscribeToBroadcastEvents ( ) { err := r . state . evsw . AddListenerForEvent ( listenerIDConsensus , types . EventNewRoundStepValue , func ( data tmevents . EventData ) { r . broadcastNewRoundStepMessage ( data . ( * cstypes . RoundState ) ) select { case r . state . onStopCh <- data . ( * cstypes . RoundState ) : default : } } , ) if err != nil { r . Logger . Error ( " " , " " , err ) } err = r . state . evsw . AddListenerForEvent ( listenerIDConsensus , types . EventValidBlockValue , func ( data tmevents . EventData ) { r . broadcastNewValidBlockMessage ( data . ( * cstypes . RoundState ) ) } , ) if err != nil { r . Logger . Error ( " " , " " , err ) } err = r . state . evsw . AddListenerForEvent ( listenerIDConsensus , types . EventVoteValue , func ( data tmevents . EventData ) { r . broadcastHasVoteMessage ( data . ( * types . Vote ) ) } , ) if err != nil { r . Logger . Error ( " " , " " , err ) } }
subscribeToBroadcastEvents subscribes for new round steps and votes using the
internal pubsub defined in the consensus state to broadcast them to peers
upon receiving.
subscribeToBroadcastEvents subscribes for new round steps and votes using the internal pubsub defined in the consensus state to broadcast them to peers upon receiving .