diff --git a/chancloser.go b/chancloser.go index 12bd75605..66bae7c34 100644 --- a/chancloser.go +++ b/chancloser.go @@ -439,7 +439,7 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b // Before publishing the closing tx, we persist it to the // database, such that it can be republished if something goes // wrong. - err = c.cfg.channel.MarkCommitmentBroadcasted(closeTx) + err = c.cfg.channel.MarkCoopBroadcasted(closeTx) if err != nil { return nil, false, err } @@ -487,7 +487,6 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b // transaction for a channel based on the prior fee negotiations and our // current compromise fee. func (c *channelCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSigned, error) { - rawSig, _, _, err := c.cfg.channel.CreateCloseProposal( fee, c.localDeliveryScript, c.remoteDeliveryScript, ) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 57f6b3704..30b39b8ea 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -6382,6 +6382,16 @@ func (lc *LightningChannel) MarkCommitmentBroadcasted(tx *wire.MsgTx) error { return lc.channelState.MarkCommitmentBroadcasted(tx) } +// MarkCoopBroadcasted marks the channel as a cooperative close transaction has +// been broadcast, and that we should watch the chain for it to confirm before +// taking any further action. +func (lc *LightningChannel) MarkCoopBroadcasted(tx *wire.MsgTx) error { + lc.Lock() + defer lc.Unlock() + + return lc.channelState.MarkCoopBroadcasted(tx) +} + // MarkDataLoss marks sets the channel status to LocalDataLoss and stores the // passed commitPoint for use to retrieve funds in case the remote force closes // the channel. diff --git a/peer.go b/peer.go index a007701b7..9f8199c3e 100644 --- a/peer.go +++ b/peer.go @@ -463,6 +463,8 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) ( fallthrough case dbChan.HasChanStatus(channeldb.ChanStatusCommitBroadcasted): fallthrough + case dbChan.HasChanStatus(channeldb.ChanStatusCoopBroadcasted): + fallthrough case dbChan.HasChanStatus(channeldb.ChanStatusLocalDataLoss): peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+ "start.", chanPoint, dbChan.ChanStatus())