Skip to content

[spec]: retransmit shutdown on reestablish #8397

@Crypt-iQ

Description

@Crypt-iQ

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:

lnd/peer/brontide.go

Lines 905 to 909 in ba4021c

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

Metadata

Metadata

Assignees

Labels

channel closingRelated to the closing of channels cooperatively and uncooperativelyspec

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions