lnwallet/btcwallet: use relay fee not tx fee rate for dust check
In this commit we fix a hidden bug in the transaction creating logic that was only manifested recently due to higher fees on Bitcoin's mainnet. Before this commit, we would use the target fee rate to determine if an output was dust or not. However, this is incorrect, as instead the relay fee should be used as this matches the policy checks widely deployed in Bitcoin full node today. To fix this issue we now properly use the relay fee when computing dust. This fixes the issue for the `EstimateFee` call, but the `SendOutputs` call also has a similar issue. However, this must be fixed within `btcwallet` itself, so it has been left out of this commit Fixes #3217.
This commit is contained in:
parent
b89b27e6ef
commit
eaa043f585
@ -330,7 +330,14 @@ func (b *BtcWallet) CreateSimpleTx(outputs []*wire.TxOut,
|
||||
return nil, lnwallet.ErrNoOutputs
|
||||
}
|
||||
for _, output := range outputs {
|
||||
err := txrules.CheckOutput(output, feeSatPerKB)
|
||||
// When checking an output for things like dusty-ness, we'll
|
||||
// use the default mempool relay fee rather than the target
|
||||
// effective fee rate to ensure accuracy. Otherwise, we may
|
||||
// mistakenly mark small-ish, but not quite dust output as
|
||||
// dust.
|
||||
err := txrules.CheckOutput(
|
||||
output, txrules.DefaultRelayFeePerKb,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user