lnwallet: for musig2 coop close fee estimation
Co-op close for musig2 chans needs to use the proper witness size.
This commit is contained in:
1 file changed
+9
-2
@@ -201,12 +201,19 @@ type ChanCloser struct {
|
|||||||
|
|
||||||
// calcCoopCloseFee computes an "ideal" absolute co-op close fee given the
|
// calcCoopCloseFee computes an "ideal" absolute co-op close fee given the
|
||||||
// delivery scripts of both parties and our ideal fee rate.
|
// delivery scripts of both parties and our ideal fee rate.
|
||||||
func calcCoopCloseFee(localOutput, remoteOutput *wire.TxOut,
|
func calcCoopCloseFee(chanType channeldb.ChannelType,
|
||||||
|
localOutput, remoteOutput *wire.TxOut,
|
||||||
idealFeeRate chainfee.SatPerKWeight) btcutil.Amount {
|
idealFeeRate chainfee.SatPerKWeight) btcutil.Amount {
|
||||||
|
|
||||||
var weightEstimator input.TxWeightEstimator
|
var weightEstimator input.TxWeightEstimator
|
||||||
|
|
||||||
|
if chanType.IsTaproot() {
|
||||||
|
weightEstimator.AddWitnessInput(
|
||||||
|
input.TaprootSignatureWitnessSize,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
weightEstimator.AddWitnessInput(input.MultiSigWitnessSize)
|
weightEstimator.AddWitnessInput(input.MultiSigWitnessSize)
|
||||||
|
}
|
||||||
|
|
||||||
// One of these outputs might be dust, so we'll skip adding it to our
|
// One of these outputs might be dust, so we'll skip adding it to our
|
||||||
// mock transaction, so the fees are more accurate.
|
// mock transaction, so the fees are more accurate.
|
||||||
@@ -235,7 +242,7 @@ func (d *SimpleCoopFeeEstimator) EstimateFee(chanType channeldb.ChannelType,
|
|||||||
localTxOut, remoteTxOut *wire.TxOut,
|
localTxOut, remoteTxOut *wire.TxOut,
|
||||||
idealFeeRate chainfee.SatPerKWeight) btcutil.Amount {
|
idealFeeRate chainfee.SatPerKWeight) btcutil.Amount {
|
||||||
|
|
||||||
return calcCoopCloseFee(localTxOut, remoteTxOut, idealFeeRate)
|
return calcCoopCloseFee(chanType, localTxOut, remoteTxOut, idealFeeRate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewChanCloser creates a new instance of the channel closure given the passed
|
// NewChanCloser creates a new instance of the channel closure given the passed
|
||||||
|
|||||||
Reference in new issue
Block a user