From d688e13d356a4e8b5dfe3e8d9aeeb79eef04cdba Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Fri, 13 Dec 2019 16:08:43 -0800 Subject: [PATCH] discovery: remove unnecessary test check It's not possible to send another reply once all replies have been sent without another request. The purpose of the check is also done within another test, TestGossipSyncerReplyChanRangeQueryNoNewChans, so it can be removed from here. --- discovery/syncer_test.go | 46 +--------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/discovery/syncer_test.go b/discovery/syncer_test.go index ee1d880a..82c07044 100644 --- a/discovery/syncer_test.go +++ b/discovery/syncer_test.go @@ -989,9 +989,7 @@ func TestGossipSyncerGenChanRangeQuery(t *testing.T) { } // TestGossipSyncerProcessChanRangeReply tests that we'll properly buffer -// replied channel replies until we have the complete version. If no new -// channels were discovered, then we should go directly to the chanSsSynced -// state. Otherwise, we should go to the queryNewChannels states. +// replied channel replies until we have the complete version. func TestGossipSyncerProcessChanRangeReply(t *testing.T) { t.Parallel() @@ -1091,48 +1089,6 @@ func TestGossipSyncerProcessChanRangeReply(t *testing.T) { t.Fatal(err) } } - - // We'll repeat our final reply again, but this time we won't send any - // new channels. As a result, we should transition over to the - // chansSynced state. - errCh = make(chan error, 1) - go func() { - select { - case <-time.After(time.Second * 15): - errCh <- errors.New("no query received") - return - case req := <-chanSeries.filterReq: - // We should get a request for the entire range of short - // chan ID's. - if !reflect.DeepEqual(expectedReq[2], req[0]) { - errCh <- fmt.Errorf("wrong request: expected %v, got %v", - expectedReq[2], req[0]) - return - } - - // We'll send back only the last two to simulate filtering. - chanSeries.filterResp <- []lnwire.ShortChannelID{} - errCh <- nil - } - }() - if err := syncer.processChanRangeReply(replies[2]); err != nil { - t.Fatalf("unable to process reply: %v", err) - } - - if syncer.syncState() != chansSynced { - t.Fatalf("wrong state: expected %v instead got %v", - chansSynced, syncer.state) - } - - // Wait for error from goroutine. - select { - case <-time.After(time.Second * 30): - t.Fatalf("goroutine did not return within 30 seconds") - case err := <-errCh: - if err != nil { - t.Fatal(err) - } - } } // TestGossipSyncerSynchronizeChanIDs tests that we properly request chunks of