Merge pull request #712 from Roasbeef/avoid-dust-change-funding

lnwallet: avoid creating dust change outputs in funding txns
This commit is contained in:
Olaoluwa Osuntokun 2018-02-01 16:20:52 -08:00 committed by GitHub
commit 609525f0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1318,8 +1318,9 @@ func (l *LightningWallet) selectCoinsAndChange(feeRatePerWeight btcutil.Amount,
}
// Record any change output(s) generated as a result of the coin
// selection.
if changeAmt != 0 {
// selection, but only if the addition of the output won't lead to the
// creation of dust.
if changeAmt != 0 && changeAmt > DefaultDustLimit() {
changeAddr, err := l.NewAddress(WitnessPubKey, true)
if err != nil {
return err