Skip to content

Add method to calculate input for a trampoline fee#589

Open
dpad85 wants to merge 2 commits intomasterfrom
reverse-trampoline-fees
Open

Add method to calculate input for a trampoline fee#589
dpad85 wants to merge 2 commits intomasterfrom
reverse-trampoline-fees

Conversation

@dpad85
Copy link
Member

@dpad85 dpad85 commented Jan 30, 2024

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.

This method returns the amount that needs to be provided to
the trampoline payment handler in order to entirely consume
a given amount, without leaving any dust.

This allows the node to send all their balance over LN.
@pm47 pm47 self-requested a review February 26, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant