BOLT2 states that "upon reconnection, if [a node] has sent a previous shutdown, [it] MUST retransmit shutdown".
We currently do this if the channel has status ChanStatusCoopBroadcasted:
|
if dbChan.HasChanStatus( |
|
channeldb.ChanStatusCoopBroadcasted, |
|
) { |
|
|
|
shutdownMsg, err := p.restartCoopClose(lnChan) |
Prior to #8167 this means that if shutdown was sent, it will be re-transmitted since initChanShutdown calls MarkCoopBroadcasted:
|
// Before continuing, mark the channel as cooperatively closed with a |
|
// nil txn. Even though we haven't negotiated the final txn, this |
|
// guarantees that our listchannels rpc will be externally consistent, |
|
// and reflect that the channel is being shutdown by the time the |
|
// closing request returns. |
|
err := c.cfg.Channel.MarkCoopBroadcasted(nil, c.locallyInitiated) |
|
if err != nil { |
|
return nil, err |
|
} |
With #8167, the call to MarkCoopBroadcasted is delayed until we are ready to send closing_signed. This means that the logic in restartCoopClose won't be called before this point. Because of this, if LND has sent shutdown, but hasn't reached the point where it sends closing_signed, and then disconnects with its peer, LND won't retransmit shutdown. To fix this, some state needs to be persisted right before we send shutdown such that LND can restart the coop close process on reestablish. This is especially important in light of #8393 where LND <-> LND coop close may not happen on restart as neither side re-transmits shutdown.
Additional things to take note of:
- the pkscript that is re-transmitted in
shutdown must be identical to the prior shutdown's pkscript
- if an
update_* and commit_sig are owed as well as a shutdown, the original ordering must be maintained
BOLT2 states that "upon reconnection, if [a node] has sent a previous
shutdown, [it] MUST retransmitshutdown".We currently do this if the channel has status
ChanStatusCoopBroadcasted:lnd/peer/brontide.go
Lines 905 to 909 in ba4021c
Prior to #8167 this means that if
shutdownwas sent, it will be re-transmitted sinceinitChanShutdowncallsMarkCoopBroadcasted:lnd/lnwallet/chancloser/chancloser.go
Lines 342 to 350 in ba4021c
With #8167, the call to
MarkCoopBroadcastedis delayed until we are ready to sendclosing_signed. This means that the logic inrestartCoopClosewon't be called before this point. Because of this, if LND has sentshutdown, but hasn't reached the point where it sendsclosing_signed, and then disconnects with its peer, LND won't retransmitshutdown. To fix this, some state needs to be persisted right before we sendshutdownsuch that LND can restart the coop close process on reestablish. This is especially important in light of #8393 where LND <-> LND coop close may not happen on restart as neither side re-transmitsshutdown.Additional things to take note of:
shutdownmust be identical to the priorshutdown's pkscriptupdate_*andcommit_sigare owed as well as ashutdown, the original ordering must be maintained