Skip to content

Commit

Permalink
discovery: remove unnecessary test check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wpaulino committed Dec 18, 2019
1 parent 09bb4df commit bcf614b
Showing 1 changed file with 1 addition and 45 deletions.
46 changes: 1 addition & 45 deletions discovery/syncer_test.go
Expand Up @@ -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()

Expand Down Expand Up @@ -1155,48 +1153,6 @@ func testGossipSyncerProcessChanRangeReply(t *testing.T, legacy bool) {
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
Expand Down

0 comments on commit bcf614b

Please sign in to comment.