mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
funding: on startup only re-create funding barriers if channel is pending
In this commit, we fix an existing bug within the funding manager. A channel barrier only needs to be create if upon startup the channel is still pending. Otherwise, we’ll re-create the funding barrier unnecessarily. This can lead to bugs when initiating payments between a channels’ lock in and when it’s announced to the together network. If during this period, a user attempts a payment, then the response won’t be archived, as the grouting will be blocked waiting on the channel barrier to close. To fix this, we only re-create the barrier if the channel hasn’t been confirmed. This eliminates one source of reported “stuck payments”.
This commit is contained in:
parent
bb174292b1
commit
71a837630a
@ -467,14 +467,16 @@ func (f *fundingManager) Start() error {
|
||||
fndgLog.Debugf("channel (%v) with opening state %v found",
|
||||
chanID, channelState)
|
||||
|
||||
// Set up the channel barriers again, to make sure
|
||||
// waitUntilChannelOpen correctly waits until the opening
|
||||
// process is completely over.
|
||||
f.barrierMtx.Lock()
|
||||
fndgLog.Tracef("Loading pending ChannelPoint(%v), "+
|
||||
"creating chan barrier", channel.FundingOutpoint)
|
||||
f.newChanBarriers[chanID] = make(chan struct{})
|
||||
f.barrierMtx.Unlock()
|
||||
if channel.IsPending {
|
||||
// Set up the channel barriers again, to make sure
|
||||
// waitUntilChannelOpen correctly waits until the
|
||||
// opening process is completely over.
|
||||
f.barrierMtx.Lock()
|
||||
fndgLog.Tracef("Loading pending ChannelPoint(%v), "+
|
||||
"creating chan barrier", channel.FundingOutpoint)
|
||||
f.newChanBarriers[chanID] = make(chan struct{})
|
||||
f.barrierMtx.Unlock()
|
||||
}
|
||||
|
||||
// If we did find the channel in the opening state database, we
|
||||
// have seen the funding transaction being confirmed, but we
|
||||
|
Loading…
Reference in New Issue
Block a user