From 45ebb9b900da26291412ff8798046f087934949a Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 3 Jun 2025 20:41:38 +0200 Subject: [PATCH] discovery: add comments to the ctx creation We highlight why we do not use the returned cancel method of the context guard. --- discovery/syncer.go | 2 ++ peer/brontide.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/discovery/syncer.go b/discovery/syncer.go index b27cc8c71..1edb6be83 100644 --- a/discovery/syncer.go +++ b/discovery/syncer.go @@ -409,6 +409,8 @@ func (g *GossipSyncer) Start() { g.started.Do(func() { log.Debugf("Starting GossipSyncer(%x)", g.cfg.peerPub[:]) + // We do not call the cancel function here, because the global + // context quit method is enough to clean up the context guard. ctx, _ := g.cg.Create(context.Background()) // TODO(conner): only spawn channelGraphSyncer if remote diff --git a/peer/brontide.go b/peer/brontide.go index 17e9bc409..7149a324c 100644 --- a/peer/brontide.go +++ b/peer/brontide.go @@ -4127,6 +4127,8 @@ func (p *Brontide) startRbfChanCloser(shutdown shutdownInit, defer rbfCloser.RemoveStateSub(coopCloseStates) } + // We do not call the cancel function here, because the global + // context quit method is enough to clean up the context guard. ctx, _ := p.cg.Create(context.Background()) feeRate := defaultFeePerKw.FeePerVByte()