wallet/txauthor: fix bug in dust calculation
In this commit, we fix a 3 year old bug in dust calculation. Before this commit, the target fee of the transaction to be crafted would be used to determine dust. If the target fee is very high, then this would cause over all higher fees, as we'd base that dust computation off of that fee rate, rather than the min relay fee. To fix this, we always use the min relay fee at all times when computing dust.
This commit is contained in:
parent
ca24ed58cf
commit
fbb3bc184d
1 changed files with 1 additions and 1 deletions
|
@ -133,7 +133,7 @@ func NewUnsignedTransaction(outputs []*wire.TxOut, relayFeePerKb btcutil.Amount,
|
|||
changeIndex := -1
|
||||
changeAmount := inputAmount - targetAmount - maxRequiredFee
|
||||
if changeAmount != 0 && !txrules.IsDustAmount(changeAmount,
|
||||
txsizes.P2WPKHPkScriptSize, relayFeePerKb) {
|
||||
txsizes.P2WPKHPkScriptSize, txrules.DefaultRelayFeePerKb) {
|
||||
changeScript, err := fetchChange()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue