lightning-kmp
lightning-kmp copied to clipboard
Add method to calculate input for a trampoline fee
This PR adds a method in TrampolineFee
that returns the exact amount that must be provided to the trampoline payment handler in order to entirely consume a given amount, without leaving any dust.
Specifically, this will allow a Phoenix wallet to send all its balance over LN.
Also, tests have been added for the existing Trampoline.calculateFees
method
Example:
- My balance is
1_000_000 sat
- The trampoline fees are
4 sat + 0.4%
- The amount that must be sent to spend the balance is
992_032 msat
, the fee would be7_968 msat
.