mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-02-01 19:25:34 +01:00
* Add support for service fees This introduces a new transaction type "service_fee" Each outgoing payment is charged a service fee of x/1000. The service fee entries is added with the routing fee reserve entry. For failed payments the service fee is reversed. * Add service_fee migration * No service fee by default * Fee reserve and service fee is optional ignore NoRows errors * Update Makefile * Unify setting the fee on the invoice * Proper error check * ups * Add service fee tests to outgoing payment tests * Save parant id to fee tx entries * Optionally load test DB from env variable * Add config for free transactions payment amounts up to NO_SERVICE_FEE_UP_TO_AMOUNT don't get a service fee charged * Update readme * cleanup * fix: only charge service fees for amounts > free limit * fix: format * Save service fee on invoice * naming * Also save the payment hash where we save the preimage we already do exactly that when in the normal PayInvoice flow. Normally the RHash is already set here, but I guess it does not hurt to have it consistent everywhere. * Use the invoice routing fee field to check if a routing fee must be charged It feels a bit indirect to check if we have set a FeeReserve. We save the routing fee on the invoice thus we should be able to use that information * remove nullzero from fee columns we want those to be 0 by default * add columns only if not existent --------- Co-authored-by: René Aaron <rene@twentyuno.net>