mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
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:
parent
a2b277cf1d
commit
4b65c71213
@ -201,12 +201,19 @@ type ChanCloser struct {
|
||||
|
||||
// calcCoopCloseFee computes an "ideal" absolute co-op close fee given the
|
||||
// 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 {
|
||||
|
||||
var weightEstimator input.TxWeightEstimator
|
||||
|
||||
if chanType.IsTaproot() {
|
||||
weightEstimator.AddWitnessInput(
|
||||
input.TaprootSignatureWitnessSize,
|
||||
)
|
||||
} else {
|
||||
weightEstimator.AddWitnessInput(input.MultiSigWitnessSize)
|
||||
}
|
||||
|
||||
// One of these outputs might be dust, so we'll skip adding it to our
|
||||
// mock transaction, so the fees are more accurate.
|
||||
@ -235,7 +242,7 @@ func (d *SimpleCoopFeeEstimator) EstimateFee(chanType channeldb.ChannelType,
|
||||
localTxOut, remoteTxOut *wire.TxOut,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user