mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
peer+chancloser: mark coop broadcasted
This commit is contained in:
parent
b3c28c9cba
commit
d9cf0396b3
3 changed files with 13 additions and 2 deletions
|
@ -439,7 +439,7 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b
|
||||||
// Before publishing the closing tx, we persist it to the
|
// Before publishing the closing tx, we persist it to the
|
||||||
// database, such that it can be republished if something goes
|
// database, such that it can be republished if something goes
|
||||||
// wrong.
|
// wrong.
|
||||||
err = c.cfg.channel.MarkCommitmentBroadcasted(closeTx)
|
err = c.cfg.channel.MarkCoopBroadcasted(closeTx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
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
|
// transaction for a channel based on the prior fee negotiations and our
|
||||||
// current compromise fee.
|
// current compromise fee.
|
||||||
func (c *channelCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSigned, error) {
|
func (c *channelCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSigned, error) {
|
||||||
|
|
||||||
rawSig, _, _, err := c.cfg.channel.CreateCloseProposal(
|
rawSig, _, _, err := c.cfg.channel.CreateCloseProposal(
|
||||||
fee, c.localDeliveryScript, c.remoteDeliveryScript,
|
fee, c.localDeliveryScript, c.remoteDeliveryScript,
|
||||||
)
|
)
|
||||||
|
|
|
@ -6382,6 +6382,16 @@ func (lc *LightningChannel) MarkCommitmentBroadcasted(tx *wire.MsgTx) error {
|
||||||
return lc.channelState.MarkCommitmentBroadcasted(tx)
|
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
|
// MarkDataLoss marks sets the channel status to LocalDataLoss and stores the
|
||||||
// passed commitPoint for use to retrieve funds in case the remote force closes
|
// passed commitPoint for use to retrieve funds in case the remote force closes
|
||||||
// the channel.
|
// the channel.
|
||||||
|
|
2
peer.go
2
peer.go
|
@ -463,6 +463,8 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) (
|
||||||
fallthrough
|
fallthrough
|
||||||
case dbChan.HasChanStatus(channeldb.ChanStatusCommitBroadcasted):
|
case dbChan.HasChanStatus(channeldb.ChanStatusCommitBroadcasted):
|
||||||
fallthrough
|
fallthrough
|
||||||
|
case dbChan.HasChanStatus(channeldb.ChanStatusCoopBroadcasted):
|
||||||
|
fallthrough
|
||||||
case dbChan.HasChanStatus(channeldb.ChanStatusLocalDataLoss):
|
case dbChan.HasChanStatus(channeldb.ChanStatusLocalDataLoss):
|
||||||
peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+
|
peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+
|
||||||
"start.", chanPoint, dbChan.ChanStatus())
|
"start.", chanPoint, dbChan.ChanStatus())
|
||||||
|
|
Loading…
Add table
Reference in a new issue