Closed JssDWt closed 3 months ago
Good points @dangeross . Regarding checking lsp liquidity since this check comes with some latency price for each payment and it is an edge case I would consider trying trampoline and if failing for liquidity fallback to regular payment. I think it should fail fast since the node plugin should check that before sending any htlcs
@dangeross @roeierez please check my last 7 commits. Instead of calling lsp_info (which is a network call) I added two changes:
With these two pieces of information we can check:
Next to that I added a flag in the SendPaymentRequest and LnurlPayRequest to signal the user doesn't want to use trampoline.
I had a case where the trampoline payment was not attempted. I don't think this mechanism is robust enough. Maybe the peer feature check has to be removed?
The status of this PR today is:
trampoline_pay
has the same assurences as pay
in the sense that it should always work and wait for the node to be available.use_trampoline
flag.trampoline_pay
when opting in to trampoline payments. Even if the LSP doesn't support them. The call should fail fast though.Re-requesting review from @roeierez and @dangeross
I imagine at some point people will ask about LSP trampoline fees. Maybe we should follow up at some point to add the fee rate to the LSP info?
Yes. The fee rate is currently not advertised in our custom protocol. That could be an additional feature. We assume a fixed fee of 0.5%.
@dangeross re-requesting review due to this added commit: 4a0a150457c1d191ae850badb7846571266a2b48
Bumped greenlight because https://github.com/Blockstream/greenlight/pull/475 was merged
This PR adds trampoline payment functionality to the SDK.
If a client sends a payment, normally the greenlight node will find routes through the gossip graph, and attempt to pay over those routes. If a route fails, it tries again. For every attempt there are multiple rounds where the greenlight node has to communicate with the signer. Trampoline payments have the advantage there will be only one outgoing payment attempt, and the LSP will do the retrying, therefore less communication rounds are necessary, hopefully improving payment performance. The tradeoff is the user may pay more fees for the route, and the user loses some privacy in the current setup, because the LSP will learn the payment destination. The initial default trampoline policy will be 0,5%.
This PR leans on the corresponding greenlight PR for trampoline payments, which is still a work in process: https://github.com/Blockstream/greenlight/pull/475
The LSP will need to run this plugin: https://github.com/breez/trampoline
Some notes about this PR:
listpays
. That's nice, because it doesn't require any changes to sync. The payments fromlistpays
have the wrongamount_msat
due to the way trampoline payments work. We solve that by putting the actual amount in a payment label for trampoline payments.TODO: