Skip to content

Commit

Permalink
peer+lnwallet: update API usage to recent channeldb changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed May 15, 2017
1 parent 7df1d75 commit 34959e4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
15 changes: 8 additions & 7 deletions lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 14 additions & 14 deletions peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 34959e4

Please sign in to comment.