From a14246c5bb7f67a214fbf7ffb49d048f0f6e2d4b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 14 Jul 2016 16:17:01 -0700 Subject: [PATCH] lnwallet: use two-value read from conf channel to detect closure --- lnwallet/wallet.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index fb1f854f..69bddfb3 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -1277,7 +1277,16 @@ func (l *LightningWallet) openChannelAfterConfirmations(res *ChannelReservation) // or the wallet signals a shutdown. out: select { - case <-confNtfn.Confirmed: + case _, ok := <-confNtfn.Confirmed: + // Reading a falsey value for the second parameter indicates that + // the notifier is in the process of shutting down. Therefore, we + // don't count this as the signal that the funding transaction has + // been confirmed. + if !ok { + res.chanOpen <- nil + return + } + break out case <-l.quit: res.chanOpen <- nil