mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-07 11:22:10 +02:00
contractcourt/chain_watcher: add channel sync message to CloseChannelSummary
This commit is contained in:
@@ -522,6 +522,15 @@ func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDet
|
||||
LocalChanConfig: c.cfg.chanState.LocalChanCfg,
|
||||
}
|
||||
|
||||
// Attempt to add a channel sync message to the close summary.
|
||||
chanSync, err := lnwallet.ChanSyncMsg(c.cfg.chanState)
|
||||
if err != nil {
|
||||
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
|
||||
"message: %v", c.cfg.chanState.FundingOutpoint, err)
|
||||
} else {
|
||||
closeSummary.LastChanSyncMsg = chanSync
|
||||
}
|
||||
|
||||
// Create a summary of all the information needed to handle the
|
||||
// cooperative closure.
|
||||
closeInfo := &CooperativeCloseInfo{
|
||||
@@ -590,6 +599,15 @@ func (c *chainWatcher) dispatchLocalForceClose(
|
||||
closeSummary.TimeLockedBalance += htlcValue
|
||||
}
|
||||
|
||||
// Attempt to add a channel sync message to the close summary.
|
||||
chanSync, err := lnwallet.ChanSyncMsg(c.cfg.chanState)
|
||||
if err != nil {
|
||||
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
|
||||
"message: %v", c.cfg.chanState.FundingOutpoint, err)
|
||||
} else {
|
||||
closeSummary.LastChanSyncMsg = chanSync
|
||||
}
|
||||
|
||||
// With the event processed, we'll now notify all subscribers of the
|
||||
// event.
|
||||
closeInfo := &LocalUnilateralCloseInfo{
|
||||
@@ -749,6 +767,15 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
|
||||
LocalChanConfig: c.cfg.chanState.LocalChanCfg,
|
||||
}
|
||||
|
||||
// Attempt to add a channel sync message to the close summary.
|
||||
chanSync, err := lnwallet.ChanSyncMsg(c.cfg.chanState)
|
||||
if err != nil {
|
||||
log.Errorf("ChannelPoint(%v): unable to create channel sync "+
|
||||
"message: %v", c.cfg.chanState.FundingOutpoint, err)
|
||||
} else {
|
||||
closeSummary.LastChanSyncMsg = chanSync
|
||||
}
|
||||
|
||||
if err := c.cfg.chanState.CloseChannel(&closeSummary); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user