mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
discovery: pass context to ProcessRemoteAnnouncement
With this, we move a context.TODO() out of the gossiper and into the brontide package - this will be removed in a future PR which focuses on threading contexts through that code.
This commit is contained in:
@@ -857,10 +857,8 @@ func (d *AuthenticatedGossiper) stop() {
|
||||
// then added to a queue for batched trickled announcement to all connected
|
||||
// peers. Remote channel announcements should contain the announcement proof
|
||||
// and be fully validated.
|
||||
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message,
|
||||
peer lnpeer.Peer) chan error {
|
||||
|
||||
ctx := context.TODO()
|
||||
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(ctx context.Context,
|
||||
msg lnwire.Message, peer lnpeer.Peer) chan error {
|
||||
|
||||
log.Debugf("Processing remote msg %T from peer=%x", msg, peer.PubKey())
|
||||
|
||||
@@ -950,8 +948,12 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message,
|
||||
|
||||
// If the peer that sent us this error is quitting, then we don't need
|
||||
// to send back an error and can return immediately.
|
||||
// TODO(elle): the peer should now just rely on canceling the passed
|
||||
// context.
|
||||
case <-peer.QuitSignal():
|
||||
return nil
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
case <-d.quit:
|
||||
nMsg.err <- ErrGossiperShuttingDown
|
||||
}
|
||||
|
Reference in New Issue
Block a user