lnwallet: check coop close fee negative balance
Also modify the test to check for this condition.
This commit is contained in:
3 files changed
+37
-8
No files matched your search
+8
-2
@@ -6182,10 +6182,13 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
|
||||
// Get the final balances after subtracting the proposed fee, taking
|
||||
// care not to persist the adjusted balance, as the feeRate may change
|
||||
// during the channel closing process.
|
||||
ourBalance, theirBalance := CoopCloseBalance(
|
||||
ourBalance, theirBalance, err := CoopCloseBalance(
|
||||
lc.channelState.ChanType, lc.channelState.IsInitiator,
|
||||
proposedFee, lc.channelState.LocalCommitment,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
closeTx := CreateCooperativeCloseTx(
|
||||
fundingTxIn(lc.channelState), lc.channelState.LocalChanCfg.DustLimit,
|
||||
@@ -6241,10 +6244,13 @@ func (lc *LightningChannel) CompleteCooperativeClose(
|
||||
}
|
||||
|
||||
// Get the final balances after subtracting the proposed fee.
|
||||
ourBalance, theirBalance := CoopCloseBalance(
|
||||
ourBalance, theirBalance, err := CoopCloseBalance(
|
||||
lc.channelState.ChanType, lc.channelState.IsInitiator,
|
||||
proposedFee, lc.channelState.LocalCommitment,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// Create the transaction used to return the current settled balance
|
||||
// on this active channel back to both parties. In this current model,
|
||||
|
||||
Reference in new issue
Block a user