mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-31 16:09:02 +02:00
lnwallet/chanfunding: assumes all change outputs are P2TR
This commit is contained in:
parent
322937a67e
commit
42549519ca
@ -98,8 +98,8 @@ func calculateFees(utxos []Coin, feeRate chainfee.SatPerKWeight) (btcutil.Amount
|
||||
requiredFeeNoChange := feeRate.FeeForWeight(totalWeight)
|
||||
|
||||
// Estimate the fee required for a transaction with a change output.
|
||||
// Assume that change output is a P2WKH output.
|
||||
weightEstimate.AddP2WKHOutput()
|
||||
// Assume that change output is a P2TR output.
|
||||
weightEstimate.AddP2TROutput()
|
||||
|
||||
// Now that we have added the change output, redo the fee
|
||||
// estimate.
|
||||
@ -209,7 +209,8 @@ func CoinSelectSubtractFees(feeRate chainfee.SatPerKWeight, amt,
|
||||
// Obtain fee estimates both with and without using a change
|
||||
// output.
|
||||
requiredFeeNoChange, requiredFeeWithChange, err := calculateFees(
|
||||
selectedUtxos, feeRate)
|
||||
selectedUtxos, feeRate,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, 0, 0, err
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func fundingFee(feeRate chainfee.SatPerKWeight, numInput int, // nolint:unparam
|
||||
|
||||
// Optionally count a change output.
|
||||
if change {
|
||||
weightEstimate.AddP2WKHOutput()
|
||||
weightEstimate.AddP2TROutput()
|
||||
}
|
||||
|
||||
totalWeight := int64(weightEstimate.Weight())
|
||||
@ -81,7 +81,7 @@ func TestCalculateFees(t *testing.T) {
|
||||
},
|
||||
|
||||
expectedFeeNoChange: 487,
|
||||
expectedFeeWithChange: 611,
|
||||
expectedFeeWithChange: 659,
|
||||
expectedErr: nil,
|
||||
},
|
||||
|
||||
@ -97,7 +97,7 @@ func TestCalculateFees(t *testing.T) {
|
||||
},
|
||||
|
||||
expectedFeeNoChange: 579,
|
||||
expectedFeeWithChange: 703,
|
||||
expectedFeeWithChange: 751,
|
||||
expectedErr: nil,
|
||||
},
|
||||
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
//
|
||||
// Steps to final channel provisioning:
|
||||
// 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.
|
||||
//
|
||||
// If either of these steps fail, then the Cancel method MUST be called.
|
||||
|
Loading…
x
Reference in New Issue
Block a user