From 34959e4648cf0f1248c9b69b0323b688a8d018fe Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 14 May 2017 19:23:51 -0700 Subject: [PATCH] peer+lnwallet: update API usage to recent channeldb changes --- lnwallet/channel.go | 15 ++++++++------- peer.go | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index e27ca0f9..f28836c2 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1011,14 +1011,15 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven // immediately delete the state from disk, creating a close // summary for future usage by related sub-systems. // TODO(roasbeef): include HTLC's + // * and time-locked balance 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, + ChanPoint: *lc.channelState.ChanID, + ClosingTXID: *commitSpend.SpenderTxHash, + RemotePub: lc.channelState.IdentityPub, + Capacity: lc.Capacity, + SettledBalance: lc.channelState.OurBalance, + CloseType: channeldb.ForceClose, + IsPending: true, } if err := lc.DeleteState(closeSummary); err != nil { walletLog.Errorf("unable to delete channel state: %v", diff --git a/peer.go b/peer.go index 9a6ed19c..ee6f22c0 100644 --- a/peer.go +++ b/peer.go @@ -900,13 +900,13 @@ func (p *peer) handleLocalClose(req *closeLinkReq) { // closed within the database. chanInfo := channel.StateSnapshot() closeSummary := &channeldb.ChannelCloseSummary{ - ChanPoint: *req.chanPoint, - ClosingTXID: *closingTxid, - RemotePub: &chanInfo.RemoteIdentity, - Capacity: chanInfo.Capacity, - OurBalance: chanInfo.LocalBalance, - CloseType: channeldb.CooperativeClose, - IsPending: true, + ChanPoint: *req.chanPoint, + ClosingTXID: *closingTxid, + RemotePub: &chanInfo.RemoteIdentity, + Capacity: chanInfo.Capacity, + SettledBalance: chanInfo.LocalBalance, + CloseType: channeldb.CooperativeClose, + IsPending: true, } if err := channel.DeleteState(closeSummary); err != nil { req.err <- err @@ -1025,13 +1025,13 @@ func (p *peer) handleRemoteClose(req *lnwire.CloseRequest) { closeTxid := closeTx.TxHash() chanInfo := channel.StateSnapshot() closeSummary := &channeldb.ChannelCloseSummary{ - ChanPoint: *chanPoint, - ClosingTXID: closeTxid, - RemotePub: &chanInfo.RemoteIdentity, - Capacity: chanInfo.Capacity, - OurBalance: chanInfo.LocalBalance, - CloseType: channeldb.CooperativeClose, - IsPending: true, + ChanPoint: *chanPoint, + ClosingTXID: closeTxid, + RemotePub: &chanInfo.RemoteIdentity, + Capacity: chanInfo.Capacity, + SettledBalance: chanInfo.LocalBalance, + CloseType: channeldb.CooperativeClose, + IsPending: true, } if err := channel.DeleteState(closeSummary); err != nil { peerLog.Errorf("unable to delete channel state: %v", err)