chancloser+cnct: disable channel before closing
This commit is contained in:
parent
3371c5fab0
commit
325d77c431
@ -427,6 +427,14 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b
|
||||
}
|
||||
c.closingTx = closeTx
|
||||
|
||||
// Before closing, we'll attempt to send a disable update for
|
||||
// the channel. We do so before closing the channel as otherwise
|
||||
// the current edge policy won't be retrievable from the graph.
|
||||
if err := c.cfg.disableChannel(c.chanPoint); err != nil {
|
||||
peerLog.Warnf("Unable to disable channel %v on "+
|
||||
"close: %v", c.chanPoint, err)
|
||||
}
|
||||
|
||||
// With the closing transaction crafted, we'll now broadcast it
|
||||
// to the network.
|
||||
peerLog.Infof("Broadcasting cooperative close tx: %v",
|
||||
@ -440,16 +448,6 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
// We'll attempt to disable the channel in the background to
|
||||
// avoid blocking due to sending the update message to all
|
||||
// active peers.
|
||||
go func() {
|
||||
if err := c.cfg.disableChannel(c.chanPoint); err != nil {
|
||||
peerLog.Errorf("Unable to disable channel %v on "+
|
||||
"close: %v", c.chanPoint, err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Finally, we'll transition to the closeFinished state, and
|
||||
// also return the final close signed message we sent.
|
||||
// Additionally, we return true for the second argument to
|
||||
|
@ -635,6 +635,14 @@ func (c *ChainArbitrator) ForceCloseContract(chanPoint wire.OutPoint) (*wire.Msg
|
||||
|
||||
log.Infof("Attempting to force close ChannelPoint(%v)", chanPoint)
|
||||
|
||||
// Before closing, we'll attempt to send a disable update for the
|
||||
// channel. We do so before closing the channel as otherwise the current
|
||||
// edge policy won't be retrievable from the graph.
|
||||
if err := c.cfg.DisableChannel(chanPoint); err != nil {
|
||||
log.Warnf("Unable to disable channel %v on "+
|
||||
"close: %v", chanPoint, err)
|
||||
}
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
respChan := make(chan *wire.MsgTx, 1)
|
||||
|
||||
@ -667,16 +675,6 @@ func (c *ChainArbitrator) ForceCloseContract(chanPoint wire.OutPoint) (*wire.Msg
|
||||
return nil, ErrChainArbExiting
|
||||
}
|
||||
|
||||
// We'll attempt to disable the channel in the background to
|
||||
// avoid blocking due to sending the update message to all
|
||||
// active peers.
|
||||
go func() {
|
||||
if err := c.cfg.DisableChannel(chanPoint); err != nil {
|
||||
log.Errorf("Unable to disable channel %v on "+
|
||||
"close: %v", chanPoint, err)
|
||||
}
|
||||
}()
|
||||
|
||||
return closeTx, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user