Hello.
I'm using the Lightning Network and if I'm not wrong, the formula to calculate the fees is
base_fee + amount_forward*(ppm/1e6). Correct me if I'm wrong or if there are other subtle nuances behind the hood. I'm using C-Lightning implementation but I think the fees formula is transparent and transversal to any implementation.
But I'm not being able to match what this formula with the fees I've been collecting from my client and also, another weird thing happening is that some forwarded payments are generating fees lower than other smaller forwards. I'll explain below with examples.
So, there are 2 things I would like to discuss: One is the fee collected not matching the formula above. Another thing is that a payment smaller than one other is generating fees lower than the smaller payment forward.
First problem:
For instance, earlier today I forward a payment of 328.258,966msat (In channel) and 328.257,223msat (Out channel). The fee collected was 1743msat.
The Out channel fee setup is:
"base_fee_millisatoshi": 1391,
"fee_per_millionth": 13,
Using the formula above I should've collected 1,391sat + 328.259,966x(13/1e6) = 5.658 sats. However I only collected 1.743sats.
So, something is wrong either with the formula or with the amount of factors I think the fee depends on.
Second problem I would like to address is a forward payment fee being smaller than the fee of one other payment which value is smaller, when the Out channel is the same, therefore the fee setup also the same.
For instance, this morning I forward 2 payments with the same Out channel. Payment 1 was 80k sats, sharp (plus the fee). Payment 2 was 50k sats sharp (plus fees).
However, payment 2 generated a higher fee than payment one, which makes no sense because payment 1 was bigger, so it should generate bigger fee, no?
So,
payment 1: 80k sats, 437msat fee
payment 2: 50k sats, 470msat fee