LocalBalanceDust and RemoteBalanceDust functions are intended to determine whether the local or remote party's balance will be dust after creating a co-op close transaction. However, these functions erroneously omit the
commitment fees associated with co-op close transactions, leading to the functions producing false negatives.
Create a co-op close transaction with a commitment fee, of a marginal amount, which would result in the outputs being dust if used in the calculation but not dust if omitted from the calculation.
Call LocalBalanceDust or RemoteBalanceDust
Observe that the functions return false even when the balance would be dust if commitment fees were accounted for.
Expected behaviour
The LocalBalanceDust and RemoteBalanceDust functions should accurately determine whether the local or remote party's balance will be dust after creating a co-op close transaction, including consideration of commitment fees.
Background
LocalBalanceDust
andRemoteBalanceDust
functions are intended to determine whether the local or remote party's balance will be dust after creating a co-op close transaction. However, these functions erroneously omit the commitment fees associated with co-op close transactions, leading to the functions producing false negatives.https://github.com/lightningnetwork/lnd/blob/4f06f587914fa3392e8ba57ab56985102c7293c7/lnwallet/channel.go#L8620-L8658
Steps to reproduce
LocalBalanceDust
orRemoteBalanceDust
false
even when the balance would be dust if commitment fees were accounted for.Expected behaviour
The
LocalBalanceDust
andRemoteBalanceDust
functions should accurately determine whether the local or remote party's balance will be dust after creating a co-op close transaction, including consideration of commitment fees.