Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to calculate input for a trampoline fee #589

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.
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.

None yet

1 participant