@@ -819,78 +819,6 @@ func TestEndedGoroutines(t *testing.T) {
819
819
ensureGoroutineExit (t )
820
820
}
821
821
822
- //func TestLeadershipMsgDissemination(t *testing.T) {
823
- // t.Parallel()
824
- // portPrefix := 3610
825
- // t1 := time.Now()
826
- // // Scenario: 20 nodes and a bootstrap node.
827
- // // The bootstrap node sends 10 leadership messages and we count
828
- // // that each node got 10 messages after a few seconds
829
- //
830
- // stopped := int32(0)
831
- // go waitForTestCompletion(&stopped, t)
832
- //
833
- // n := 10
834
- // msgsCount2Send := 10
835
- // boot := newGossipInstance(portPrefix, 0, 100)
836
- // boot.JoinChan(&joinChanMsg{}, common.ChainID("A"))
837
- // boot.UpdateChannelMetadata([]byte{}, common.ChainID("A"))
838
- //
839
- // peers := make([]Gossip, n)
840
- // receivedMessages := make([]int, n)
841
- // wg := sync.WaitGroup{}
842
- // wg.Add(n)
843
- // for i := 1; i <= n; i++ {
844
- // pI := newGossipInstance(portPrefix, i, 100, 0)
845
- // peers[i-1] = pI
846
- // pI.JoinChan(&joinChanMsg{}, common.ChainID("A"))
847
- // pI.UpdateChannelMetadata([]byte{}, common.ChainID("A"))
848
- // acceptChan, _ := pI.Accept(acceptLeadershp, false)
849
- // go func(index int, ch <-chan *proto.GossipMessage) {
850
- // defer wg.Done()
851
- // for j := 0; j < msgsCount2Send; j++ {
852
- // <-ch
853
- // receivedMessages[index]++
854
- // }
855
- // }(i-1, acceptChan)
856
- // }
857
- //
858
- // membershipTime := time.Now()
859
- // waitUntilOrFail(t, checkPeersMembership(peers, n))
860
- // t.Log("Membership establishment took", time.Since(membershipTime))
861
- //
862
- // seqNum := 0
863
- // incTime := uint64(time.Now().UnixNano())
864
- //
865
- // for i := 1; i <= msgsCount2Send; i++ {
866
- // seqNum++
867
- // leadershipMsg := createLeadershipMsg(true, common.ChainID("A"), incTime, uint64(seqNum), boot.(*gossipServiceImpl).conf.SelfEndpoint, boot.(*gossipServiceImpl).comm.GetPKIid())
868
- // boot.Gossip(leadershipMsg)
869
- // time.Sleep(time.Duration(500) * time.Millisecond)
870
- // }
871
- //
872
- // t2 := time.Now()
873
- // waitUntilOrFailBlocking(t, wg.Wait)
874
- // t.Log("Leadership message dissemination took", time.Since(t2))
875
- //
876
- // for i := 0; i < n; i++ {
877
- // assert.Equal(t, msgsCount2Send, receivedMessages[i])
878
- // }
879
- // t.Log("Stopping peers")
880
- //
881
- // stop := func() {
882
- // stopPeers(append(peers, boot))
883
- // }
884
- //
885
- // stopTime := time.Now()
886
- // waitUntilOrFailBlocking(t, stop)
887
- // t.Log("Stop took", time.Since(stopTime))
888
- // t.Log("Took", time.Since(t1))
889
- // atomic.StoreInt32(&stopped, int32(1))
890
- // fmt.Println("<<<TestLeadershipMsgDissemination>>>")
891
- // testWG.Done()
892
- //}
893
-
894
822
func createDataMsg (seqnum uint64 , data []byte , hash string , channel common.ChainID ) * proto.GossipMessage {
895
823
return & proto.GossipMessage {
896
824
Channel : []byte (channel ),
0 commit comments