funding: fix bug that marks channel as open when ChainNotifier exist early
This commit fixes a bug that resulted from properly failing to do a 2-value read from the confirmation notification channel. If the ChainNotifier was shutting down, then a nil read could be generated which may prematurely mark the channel as open, and also trigger a nil pointer panic exception below when the confDetails are accessed. We fix this issue, by ensuring that we check the second value to see if the channel has been closed or not.
This commit is contained in:
parent
02b7b911fb
commit
c1fbcae572
@ -882,7 +882,13 @@ func (f *fundingManager) waitForFundingConfirmation(
|
||||
|
||||
// Wait until the specified number of confirmations has been reached,
|
||||
// or the wallet signals a shutdown.
|
||||
confDetails := <-confNtfn.Confirmed
|
||||
confDetails, ok := <-confNtfn.Confirmed
|
||||
if !ok {
|
||||
fndgLog.Infof("ChainNotifier shutting down, cannot complete "+
|
||||
"funding flow for ChannelPoint(%v)",
|
||||
completeChan.FundingOutpoint)
|
||||
return
|
||||
}
|
||||
|
||||
fundingPoint := *completeChan.FundingOutpoint
|
||||
fndgLog.Infof("ChannelPoint(%v) is now active",
|
||||
|
Loading…
Reference in New Issue
Block a user