Closed justinmoon closed 1 year ago
Actually I think this is already enforced with the maxfeelimit
parameter we send to the pay
RPC to Core Lightning. The problem is that in practice routing doesn't work very well when we send the parameter on mainnet.
Also, the % fee parameter is ignored for small payments that would have too low of a fee limit, which is actually an attack vector. Afaik the absolute fee limit option doesn't have this problem and we should use it.
Closing in favor of https://github.com/fedimint/fedimint/issues/524
When user client's fund an outgoing contract, they currently choose an amount that is 1% more than the invoice amount. The gateway pays their routing fees from this fee and takes the rest as profit.
When deciding whether to pay an invoice or not, a gateway should take routing fees into account. Currently, it does not. It just checks if the outgoing account isn't more than the invoice amount. It should check
invoice_amount + expected_routing_fees >= contract_amount
. Left side is what gateway pays, right side is what it receives. Might want to also include a profit margin, but that's another topic.