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 2018-09-16 10:40:10 +02:00
parent 25f6094802
commit 76857dbcdc
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -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: