-
Notifications
You must be signed in to change notification settings - Fork 46
Description
The documentation of receive states:
...
///The invoice includes negotiation of an LSPS2 / JIT
/// channel, meaning that if there is no channel sufficient to
/// receive the requested funds, the node will negotiate an
/// opening, ...
For me this sounds like calling receive will only result in a new channel if we either
a.) Don't have a channel or
b.) Don't have enough inbound liquidity for the requested invoice amount.
Looking at the code, the following happens:
receive calls the gRPC method LspInvoice which on the
service side -- to be found in gl-plugin -- will call get_lsps_offers to ask all
peers for an lsps2 offer. If get_lsps_offers fails or does not return a single lsp
offer, lsp_invoice will return an error.
This contradicts the statement above. When trying to recieve a payment, we
don't check for any funds, try to request a jit-channel in any case and fail if
we can't find an offer.
We should check for sufficient inbound liquidity first, before requesting a
jit-channel offer.
Who is responsible for this check tho?
The SDK is aware of LspInvoice, Invioce and Listpeerchannels so
we can decide inside of receive with some margin:
If
use LspInvoice, otherwise use Invoice