lnwallet: modify CoopCloseBalance to not depend on chan commit

This commit is contained in:
Olaoluwa Osuntokun authored and Oliver Gugger committed 2024-09-19 10:18:40 +02:00
1 parent 8d651b9370
commit 625d426a56
2 files changed
+11 -9

No files matched your search

+8 -2
View File
@@ -7781,7 +7781,10 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
// during the channel closing process.
ourBalance, theirBalance, err := CoopCloseBalance(
lc.channelState.ChanType, lc.channelState.IsInitiator,
proposedFee, lc.channelState.LocalCommitment,
proposedFee,
lc.channelState.LocalCommitment.LocalBalance.ToSatoshis(),
lc.channelState.LocalCommitment.RemoteBalance.ToSatoshis(),
lc.channelState.LocalCommitment.CommitFee,
)
if err != nil {
return nil, nil, 0, err
@@ -7879,7 +7882,10 @@ func (lc *LightningChannel) CompleteCooperativeClose(
// Get the final balances after subtracting the proposed fee.
ourBalance, theirBalance, err := CoopCloseBalance(
lc.channelState.ChanType, lc.channelState.IsInitiator,
proposedFee, lc.channelState.LocalCommitment,
proposedFee,
lc.channelState.LocalCommitment.LocalBalance.ToSatoshis(),
lc.channelState.LocalCommitment.RemoteBalance.ToSatoshis(),
lc.channelState.LocalCommitment.CommitFee,
)
if err != nil {
return nil, 0, err