From 53fa13bc299adcd40903104c33cb77ca76dab17c Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 16 Feb 2023 13:25:53 +0800 Subject: [PATCH] htlcswitch: fix HandleChannelUpdate by selecting on link's quit chan --- htlcswitch/link.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 88476f33e..bb800f5e4 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2743,6 +2743,15 @@ func (l *channelLink) handleSwitchPacket(pkt *htlcPacket) error { // // NOTE: Part of the ChannelLink interface. func (l *channelLink) HandleChannelUpdate(message lnwire.Message) { + select { + case <-l.quit: + // Return early if the link is already in the process of + // quitting. It doesn't make sense to hand the message to the + // mailbox here. + return + default: + } + l.mailBox.AddMessage(message) }