mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-09 14:39:54 +02:00
fundingManager: conditional select on arbiterChan and peer.newChannels
This commit adds a select statement for sending on the fundingManager's arbiterChan and the peer's newChannels channel. This makes sure we won't be blocked sending on these channels in case of a shutdown.
This commit is contained in:
parent
ee2eec6188
commit
ff2adf96a9
@ -1652,7 +1652,11 @@ func (f *fundingManager) handleFundingLocked(fmsg *fundingLockedMsg) {
|
|||||||
// With the channel retrieved, we'll send the breach arbiter the new
|
// With the channel retrieved, we'll send the breach arbiter the new
|
||||||
// channel so it can watch for attempts to breach the channel's
|
// channel so it can watch for attempts to breach the channel's
|
||||||
// contract by the remote party.
|
// contract by the remote party.
|
||||||
f.cfg.ArbiterChan <- channel
|
select {
|
||||||
|
case f.cfg.ArbiterChan <- channel:
|
||||||
|
case <-f.quit:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Launch a defer so we _ensure_ that the channel barrier is properly
|
// Launch a defer so we _ensure_ that the channel barrier is properly
|
||||||
// closed even if the target peer is not longer online at this point.
|
// closed even if the target peer is not longer online at this point.
|
||||||
@ -1683,7 +1687,12 @@ func (f *fundingManager) handleFundingLocked(fmsg *fundingLockedMsg) {
|
|||||||
channel: channel,
|
channel: channel,
|
||||||
done: newChanDone,
|
done: newChanDone,
|
||||||
}
|
}
|
||||||
peer.newChannels <- newChanMsg
|
|
||||||
|
select {
|
||||||
|
case peer.newChannels <- newChanMsg:
|
||||||
|
case <-f.quit:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// We pause here to wait for the peer to recognize the new channel
|
// We pause here to wait for the peer to recognize the new channel
|
||||||
// before we close the channel barrier corresponding to the channel.
|
// before we close the channel barrier corresponding to the channel.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user