consensus: add nil check to gossip routine (#8288)

This commit is contained in:
Sam Kleinman
2022-04-08 17:13:10 -04:00
committed by GitHub
parent 3e3a934818
commit 631ef7aae0

View File

@@ -836,10 +836,20 @@ func (r *Reactor) queryMaj23Routine(ctx context.Context, ps *PeerState, stateCh
return
}
rs := r.getRoundState()
prs := ps.GetRoundState()
// TODO create more reliable coppies of these
// TODO create more reliable copies of these
// structures so the following go routines don't race
rs := r.getRoundState()
if rs.Votes == nil {
// if we have gotten here, we've connected to
// a peer before the state of the reactor has
// updated to the current round, so we should
// sleep for a while before we attempt to
// start gossiping the data that doesn't exist
// yet. This prevents a panic.
timer.Reset(r.state.config.PeerQueryMaj23SleepDuration)
continue
}
prs := ps.GetRoundState()
wg := &sync.WaitGroup{}