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

Fee calculation rules unclear #6351

Closed
emplexity opened this issue Mar 21, 2022 · 5 comments
Closed

Fee calculation rules unclear #6351

emplexity opened this issue Mar 21, 2022 · 5 comments

Comments

@emplexity
Copy link

emplexity commented Mar 21, 2022

Background

Quoting from https://docs.lightning.engineering/lightning-network-tools/lnd/channel-fees, " Fees are applied only once per channel by the party which is forwarding the fee. Meaning, as you push a payment to your neighbor node, you are able to charge a fee, and as payments are pushed to you, your neighbor charges the fee, even if the channel was created by you."

Inferring from the fees calculated by LND suggests that the fees charged & received by a node X forwarding a payment are calculated using the base fees and fee rates as set by node X for the inbound channel and outbound channel of the forwarded payment by the following formula: feed charged = max (fee(inbound channel), fee(outbound channel)).

The documentation is not explicit about the rules that LND uses to establish the fees and about their impact on how a node uses these rules in the payment routing policy.

Your environment

  • version of lnd lncli version 0.14.1-beta commit=v0.14.1-beta
  • which operating system (uname -a on *Nix) Ubuntu server 16.04
  • version of btcd, bitcoind, or other backend Bitcoin Core RPC client version v22.0.0
  • any other relevant environment details

Steps to reproduce

Documentation issue, see above

Expected behaviour

The document should be explicit about the rules used to calculate and charge the fee by a node on the basis of the fee policy that this node applies for its channels, taking into account whether the channel is inbound or outbound for the payment.
The documentation should be explicit about the impact of these rules on the routing policy of a payment.

Actual behaviour

Not clear whether the fees charged by a node are based on the inbound channel and/or outbound channel fee policy(ies).

@alexbosworth
Copy link
Contributor

There's also a repo for that docs https://github.com/lightninglabs/docs.lightning.engineering

@lucasdcf
Copy link

@emplexity Please re-open this issue under the repo linked by Bosworth.

@Liongrass
Copy link
Contributor

Hi @emplexity !
Thank you for reading the guides carefully! I've addressed your issue and worked to make the paragraph clearer:
https://docs.lightning.engineering/lightning-network-tools/lnd/channel-fees
If you feel the change still does not accurately explain the phenomenon, feel free to comment below!
Leo

@emplexity
Copy link
Author

Thanks for the quick feedback.
The amended text refers to the concept of "capital" which would gain to be defined (e.g. local balance as opposed to remote balance?). As well, would it be possible for the text to state explicitly how the fees are calculated. See a suggestion below for your consideration:
"Fees are applied only once per peer and per channel. Each peer can independently set their fee policies for all their channels. The fees are applied to the incoming HTLC in the event of a forward. Meaning, as you push a payment to your neighbor node, you are able to charge a fee, and as payments are pushed to you, your neighbor charges the fee, even if the channel was created by you. The fees applied by a forwarding node are the maximum of:

  • the fees on the inbound HTLC according the fee policy of the inbound channel and;
  • the fees on the inbound HTLC according the fee policy of the outbound channel."
    The last sentence should be validated or adjusted to reflect the actual rule implemented by LND to calculate the fees.
    The statement below is ambiguous as in the case that a channel is depleted, the payment is refused by the node and no fee is therefore applied.
    "Another rule of thumb is that when your capital in a channel is depleted, you get to charge the fee."
    Hope this help.

@emplexity
Copy link
Author

Note that following the recommendation of @lucasdcf I opened the issue in lightninglabs/docs.lightning.engineering#321

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

No branches or pull requests

4 participants