lnwallet/chanfunding: assumes all change outputs are P2TR
This commit is contained in:
3 files changed
+8
-7
No files matched your search
@@ -98,8 +98,8 @@ func calculateFees(utxos []Coin, feeRate chainfee.SatPerKWeight) (btcutil.Amount
|
|||||||
requiredFeeNoChange := feeRate.FeeForWeight(totalWeight)
|
requiredFeeNoChange := feeRate.FeeForWeight(totalWeight)
|
||||||
|
|
||||||
// Estimate the fee required for a transaction with a change output.
|
// Estimate the fee required for a transaction with a change output.
|
||||||
// Assume that change output is a P2WKH output.
|
// Assume that change output is a P2TR output.
|
||||||
weightEstimate.AddP2WKHOutput()
|
weightEstimate.AddP2TROutput()
|
||||||
|
|
||||||
// Now that we have added the change output, redo the fee
|
// Now that we have added the change output, redo the fee
|
||||||
// estimate.
|
// estimate.
|
||||||
@@ -209,7 +209,8 @@ func CoinSelectSubtractFees(feeRate chainfee.SatPerKWeight, amt,
|
|||||||
// Obtain fee estimates both with and without using a change
|
// Obtain fee estimates both with and without using a change
|
||||||
// output.
|
// output.
|
||||||
requiredFeeNoChange, requiredFeeWithChange, err := calculateFees(
|
requiredFeeNoChange, requiredFeeWithChange, err := calculateFees(
|
||||||
selectedUtxos, feeRate)
|
selectedUtxos, feeRate,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func fundingFee(feeRate chainfee.SatPerKWeight, numInput int, // nolint:unparam
|
|||||||
|
|
||||||
// Optionally count a change output.
|
// Optionally count a change output.
|
||||||
if change {
|
if change {
|
||||||
weightEstimate.AddP2WKHOutput()
|
weightEstimate.AddP2TROutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
totalWeight := int64(weightEstimate.Weight())
|
totalWeight := int64(weightEstimate.Weight())
|
||||||
@@ -81,7 +81,7 @@ func TestCalculateFees(t *testing.T) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
expectedFeeNoChange: 487,
|
expectedFeeNoChange: 487,
|
||||||
expectedFeeWithChange: 611,
|
expectedFeeWithChange: 659,
|
||||||
expectedErr: nil,
|
expectedErr: nil,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ func TestCalculateFees(t *testing.T) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
expectedFeeNoChange: 579,
|
expectedFeeNoChange: 579,
|
||||||
expectedFeeWithChange: 703,
|
expectedFeeWithChange: 751,
|
||||||
expectedErr: nil,
|
expectedErr: nil,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
//
|
//
|
||||||
// Steps to final channel provisioning:
|
// Steps to final channel provisioning:
|
||||||
// 1. Call BindKeys to notify the intent which keys to use when constructing
|
// 1. Call BindKeys to notify the intent which keys to use when constructing
|
||||||
// the multi-sig output.
|
// the multi-sig output.
|
||||||
// 2. Call CompileFundingTx afterwards to obtain the funding transaction.
|
// 2. Call CompileFundingTx afterwards to obtain the funding transaction.
|
||||||
//
|
//
|
||||||
// If either of these steps fail, then the Cancel method MUST be called.
|
// If either of these steps fail, then the Cancel method MUST be called.
|
||||||
|
|||||||
Reference in new issue
Block a user