lightning-kmp icon indicating copy to clipboard operation
lightning-kmp copied to clipboard

Add method to calculate input for a trampoline fee

Open dpad85 opened this issue 1 year ago • 0 comments

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 be 7_968 msat.

dpad85 avatar Jan 30 '24 13:01 dpad85