From bf036f266552ee5e9a6433ad853801474964a4f0 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 2 Dec 2020 06:20:31 +0800 Subject: [PATCH] htlcswitch: close the updateFeeTimer properly --- htlcswitch/link.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 6a7c3128..df6bafc9 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -516,7 +516,14 @@ func (l *channelLink) Stop() { l.cfg.ChainEvents.Cancel() } - l.updateFeeTimer.Stop() + // Ensure the channel for the timer is drained. + if !l.updateFeeTimer.Stop() { + select { + case <-l.updateFeeTimer.C: + default: + } + } + l.hodlQueue.Stop() close(l.quit)