Browse Source

test: dont start cs until all peers connected

pull/342/head
Ethan Buchman 8 years ago
parent
commit
706dd1d6c5
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      consensus/reactor_test.go

+ 9
- 1
consensus/reactor_test.go View File

@ -62,7 +62,7 @@ func TestValidatorSetChanges(t *testing.T) {
reactors := make([]*ConsensusReactor, nPeers)
eventChans := make([]chan interface{}, nPeers)
for i := 0; i < nPeers; i++ {
reactors[i] = NewConsensusReactor(css[i], false)
reactors[i] = NewConsensusReactor(css[i], true) // so we dont start the consensus states
eventSwitch := events.NewEventSwitch()
_, err := eventSwitch.Start()
@ -78,6 +78,14 @@ func TestValidatorSetChanges(t *testing.T) {
return s
}, p2p.Connect2Switches)
// now that everyone is connected, start the state machines
// (otherwise, we could block forever in firing new block while a peer is trying to
// access state info for AddPeer)
for i := 0; i < nPeers; i++ {
s := reactors[i].conS.GetState()
reactors[i].SwitchToConsensus(s)
}
// map of active validators
activeVals := make(map[string]struct{})
for i := 0; i < nVals; i++ {


Loading…
Cancel
Save