discovery: revert passing ctx through to Start methods

This commit is contained in:
Elle Mouton
2025-04-11 09:54:28 +02:00
parent da3deeee7c
commit c68a19c0ba
8 changed files with 35 additions and 51 deletions

View File

@@ -1703,7 +1703,6 @@ func queryBatch(t *testing.T,
// them.
func TestGossipSyncerRoutineSync(t *testing.T) {
t.Parallel()
ctx := context.Background()
// We'll modify the chunk size to be a smaller value, so we can ensure
// our chunk parsing works properly. With this value we should get 3
@@ -1718,13 +1717,13 @@ func TestGossipSyncerRoutineSync(t *testing.T) {
msgChan1, syncer1, chanSeries1 := newTestSyncer(
highestID, defaultEncoding, chunkSize, true, false,
)
syncer1.Start(ctx)
syncer1.Start()
defer syncer1.Stop()
msgChan2, syncer2, chanSeries2 := newTestSyncer(
highestID, defaultEncoding, chunkSize, false, true,
)
syncer2.Start(ctx)
syncer2.Start()
defer syncer2.Stop()
// Although both nodes are at the same height, syncer will have 3 chan
@@ -1851,7 +1850,6 @@ func TestGossipSyncerRoutineSync(t *testing.T) {
// final state and not perform any channel queries.
func TestGossipSyncerAlreadySynced(t *testing.T) {
t.Parallel()
ctx := context.Background()
// We'll modify the chunk size to be a smaller value, so we can ensure
// our chunk parsing works properly. With this value we should get 3
@@ -1867,13 +1865,13 @@ func TestGossipSyncerAlreadySynced(t *testing.T) {
msgChan1, syncer1, chanSeries1 := newTestSyncer(
highestID, defaultEncoding, chunkSize,
)
syncer1.Start(ctx)
syncer1.Start()
defer syncer1.Stop()
msgChan2, syncer2, chanSeries2 := newTestSyncer(
highestID, defaultEncoding, chunkSize,
)
syncer2.Start(ctx)
syncer2.Start()
defer syncer2.Stop()
// The channel state of both syncers will be identical. They should
@@ -2073,7 +2071,6 @@ func TestGossipSyncerAlreadySynced(t *testing.T) {
// carries out its duties when accepting a new sync transition request.
func TestGossipSyncerSyncTransitions(t *testing.T) {
t.Parallel()
ctx := context.Background()
assertMsgSent := func(t *testing.T, msgChan chan []lnwire.Message,
msg lnwire.Message) {
@@ -2194,7 +2191,7 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
// We'll then start the syncer in order to process the
// request.
syncer.Start(ctx)
syncer.Start()
defer syncer.Stop()
syncer.ProcessSyncTransition(test.finalSyncType)
@@ -2219,7 +2216,6 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
// historical sync with the remote peer.
func TestGossipSyncerHistoricalSync(t *testing.T) {
t.Parallel()
ctx := context.Background()
// We'll create a new gossip syncer and manually override its state to
// chansSynced. This is necessary as the syncer can only process
@@ -2231,7 +2227,7 @@ func TestGossipSyncerHistoricalSync(t *testing.T) {
syncer.setSyncType(PassiveSync)
syncer.setSyncState(chansSynced)
syncer.Start(ctx)
syncer.Start()
defer syncer.Stop()
syncer.historicalSync()
@@ -2264,7 +2260,6 @@ func TestGossipSyncerHistoricalSync(t *testing.T) {
// syncer reaches its terminal chansSynced state.
func TestGossipSyncerSyncedSignal(t *testing.T) {
t.Parallel()
ctx := context.Background()
// We'll create a new gossip syncer and manually override its state to
// chansSynced.
@@ -2279,7 +2274,7 @@ func TestGossipSyncerSyncedSignal(t *testing.T) {
signalChan := syncer.ResetSyncedSignal()
// Starting the gossip syncer should cause the signal to be delivered.
syncer.Start(ctx)
syncer.Start()
select {
case <-signalChan:
@@ -2298,7 +2293,7 @@ func TestGossipSyncerSyncedSignal(t *testing.T) {
syncer.setSyncState(chansSynced)
syncer.Start(ctx)
syncer.Start()
defer syncer.Stop()
signalChan = syncer.ResetSyncedSignal()
@@ -2317,7 +2312,6 @@ func TestGossipSyncerSyncedSignal(t *testing.T) {
// said limit are not processed.
func TestGossipSyncerMaxChannelRangeReplies(t *testing.T) {
t.Parallel()
ctx := context.Background()
msgChan, syncer, chanSeries := newTestSyncer(
lnwire.ShortChannelID{BlockHeight: latestKnownHeight},
@@ -2328,7 +2322,7 @@ func TestGossipSyncerMaxChannelRangeReplies(t *testing.T) {
// the sake of testing.
syncer.cfg.maxQueryChanRangeReplies = 100
syncer.Start(ctx)
syncer.Start()
defer syncer.Stop()
// Upon initialization, the syncer should submit a QueryChannelRange