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",
|
fndgLog.Debugf("channel (%v) with opening state %v found",
|
||||||
chanID, channelState)
|
chanID, channelState)
|
||||||
|
|
||||||
// Set up the channel barriers again, to make sure
|
if channel.IsPending {
|
||||||
// waitUntilChannelOpen correctly waits until the opening
|
// Set up the channel barriers again, to make sure
|
||||||
// process is completely over.
|
// waitUntilChannelOpen correctly waits until the
|
||||||
f.barrierMtx.Lock()
|
// opening process is completely over.
|
||||||
fndgLog.Tracef("Loading pending ChannelPoint(%v), "+
|
f.barrierMtx.Lock()
|
||||||
"creating chan barrier", channel.FundingOutpoint)
|
fndgLog.Tracef("Loading pending ChannelPoint(%v), "+
|
||||||
f.newChanBarriers[chanID] = make(chan struct{})
|
"creating chan barrier", channel.FundingOutpoint)
|
||||||
f.barrierMtx.Unlock()
|
f.newChanBarriers[chanID] = make(chan struct{})
|
||||||
|
f.barrierMtx.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// If we did find the channel in the opening state database, we
|
// If we did find the channel in the opening state database, we
|
||||||
// have seen the funding transaction being confirmed, but we
|
// have seen the funding transaction being confirmed, but we
|
||||||
|
Loading…
Reference in New Issue
Block a user