lnd+lnwallet: make capacity check stricter by adding fee

Also patches breacharbiter tests by using the correct commitment
fee and balances.
This commit is contained in:
eugene committed 2021-02-22 12:07:21 -05:00
1 parent c9ed5927f6
commit bc238ee84c
2 files changed
+8 -6

No files matched your search

+2 -2
View File
@@ -589,11 +589,11 @@ func (cb *CommitmentBuilder) createUnsignedCommitmentTx(ourBalance,
for _, txOut := range commitTx.TxOut {
totalOut += btcutil.Amount(txOut.Value)
}
if totalOut > cb.chanState.Capacity {
if totalOut+commitFee > cb.chanState.Capacity {
return nil, fmt.Errorf("height=%v, for ChannelPoint(%v) "+
"attempts to consume %v while channel capacity is %v",
height, cb.chanState.FundingOutpoint,
totalOut, cb.chanState.Capacity)
totalOut+commitFee, cb.chanState.Capacity)
}
return &unsignedCommitmentTx{