fungingmanager: move handleFundingConfirmation out of waitForfundingConfirmation

This commit moves the handling of a funding confirmation out of
waitForFundingConfirmation, and instead let the caller handle marking
the channel opened.
This commit is contained in:
Johan T. Halseth 2018-09-16 10:40:10 +02:00
parent b51b76b469
commit 25f6094802
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -1792,6 +1792,14 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) {
}
}
err = f.handleFundingConfirmation(completeChan, *shortChanID)
if err != nil {
fndgLog.Errorf("unable to handle funding confirmation "+
"for ChannelPoint(%v): %v",
completeChan.FundingOutpoint, err)
return
}
fndgLog.Debugf("Channel with ShortChanID %v now confirmed",
shortChanID.ToUint64())
@ -1873,6 +1881,16 @@ 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:
@ -1990,12 +2008,6 @@ func (f *fundingManager) waitForFundingConfirmation(
TxPosition: uint16(fundingPoint.Index),
}
err = f.handleFundingConfirmation(completeChan, shortChanID)
if err != nil {
fndgLog.Errorf("Unable to handle funding confirmation: %v", err)
return
}
select {
case confChan <- &shortChanID:
case <-f.quit: