fundingmanager: move handleFundingConfirmation out of waitForFundingWithTimeout

Similarly to what we did in the previous commit, we move the
responsibility of marking the channel open by calling
handleFundingConfirmation out from waitForFundingWithTimeout to the
caller.
This commit is contained in:
Johan T. Halseth committed 2019-09-24 21:24:34 +02:00
1 parent 25f6094802
commit 76857dbcdc
1 file changed
+16 -10
+16 -10
View File
@@ -571,6 +571,14 @@ func (f *fundingManager) start() error {
fndgLog.Debugf("ChannelID(%v) is now fully confirmed! "+
"(shortChanID=%v)", chanID, shortChanID)
err = f.handleFundingConfirmation(ch, *shortChanID)
if err != nil {
fndgLog.Errorf("unable to handle funding "+
"confirmation for ChannelPoint(%v): %v",
ch.FundingOutpoint, err)
return
}
f.wg.Add(1)
go f.advanceFundingState(ch, nil)
}(channel)
@@ -1635,6 +1643,14 @@ func (f *fundingManager) handleFundingCreated(fmsg *fundingCreatedMsg) {
fndgLog.Debugf("ChannelID(%v) is now fully confirmed! "+
"(shortChanID=%v)", channelID, shortChanID)
err = f.handleFundingConfirmation(completeChan, *shortChanID)
if err != nil {
fndgLog.Errorf("unable to handle funding "+
"confirmation for ChannelPoint(%v): %v",
completeChan.FundingOutpoint, err)
return
}
f.wg.Add(1)
go f.advanceFundingState(completeChan, nil)
@@ -1881,16 +1897,6 @@ func (f *fundingManager) waitForFundingWithTimeout(completeChan *channeldb.OpenC
return
}
err = f.handleFundingConfirmation(
completeChan, *shortChanID,
)
if err != nil {
fndgLog.Errorf("unable to handle funding "+
"confirmation for ChannelPoint(%v): %v",
completeChan.FundingOutpoint, err)
return
}
select {
case confChan <- shortChanID:
case <-f.quit: