mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-09 18:52:09 +02:00
peer/lnwallet: persist shutdown info on send
In this commit, we start persisting shutdown info when we send the Shutdown message. When starting up a link, we also first check if we have previously persisted Shutdown info and if we have, we start the link in shutdown mode meaning that it will not accept any new outgoing HTLC additions and it will queue the shutdown message after any pending CommitSig has been sent.
This commit is contained in:
@@ -356,6 +356,17 @@ func (c *ChanCloser) initChanShutdown() (*lnwire.Shutdown, error) {
|
||||
chancloserLog.Infof("ChannelPoint(%v): sending shutdown message",
|
||||
c.chanPoint)
|
||||
|
||||
// At this point, we persist any relevant info regarding the Shutdown
|
||||
// message we are about to send in order to ensure that if a
|
||||
// re-establish occurs then we will re-send the same Shutdown message.
|
||||
shutdownInfo := channeldb.NewShutdownInfo(
|
||||
c.localDeliveryScript, c.locallyInitiated,
|
||||
)
|
||||
err := c.cfg.Channel.MarkShutdownSent(shutdownInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return shutdown, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user