Merge pull request #712 from Roasbeef/avoid-dust-change-funding
lnwallet: avoid creating dust change outputs in funding txns
This commit is contained in:
commit
609525f0e8
@ -1318,8 +1318,9 @@ func (l *LightningWallet) selectCoinsAndChange(feeRatePerWeight btcutil.Amount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record any change output(s) generated as a result of the coin
|
// Record any change output(s) generated as a result of the coin
|
||||||
// selection.
|
// selection, but only if the addition of the output won't lead to the
|
||||||
if changeAmt != 0 {
|
// creation of dust.
|
||||||
|
if changeAmt != 0 && changeAmt > DefaultDustLimit() {
|
||||||
changeAddr, err := l.NewAddress(WitnessPubKey, true)
|
changeAddr, err := l.NewAddress(WitnessPubKey, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user