mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 08:55:59 +01:00
lnwallet: upon force close detection populate close summary
This commit is contained in:
parent
be583306ab
commit
5e48cf1273
1 changed files with 12 additions and 2 deletions
|
@ -1001,10 +1001,20 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
|
|||
walletLog.Infof("Unilateral close of ChannelPoint(%v) "+
|
||||
"detected", lc.channelState.ChanID)
|
||||
|
||||
// As we've deleted that the channel has been closed,
|
||||
// As we've detected that the channel has been closed,
|
||||
// immediately delete the state from disk, creating a close
|
||||
// summary for future usage by related sub-systems.
|
||||
if err := lc.DeleteState(); err != nil {
|
||||
// TODO(roasbeef): include HTLC's
|
||||
closeSummary := &channeldb.ChannelCloseSummary{
|
||||
ChanPoint: *lc.channelState.ChanID,
|
||||
ClosingTXID: *commitSpend.SpenderTxHash,
|
||||
RemotePub: lc.channelState.IdentityPub,
|
||||
Capacity: lc.Capacity,
|
||||
OurBalance: lc.channelState.OurBalance,
|
||||
CloseType: channeldb.ForceClose,
|
||||
IsPending: true,
|
||||
}
|
||||
if err := lc.DeleteState(closeSummary); err != nil {
|
||||
walletLog.Errorf("unable to delete channel state: %v",
|
||||
err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue