Open
Description
- To allow 0-conf channels, set UserConfig::manually_accept_inbound_channel and start handling OpenChannelRequest events via the ChannelManager::accept_inbound_channel_from_trusted_peer_0conf call
- Configure LiquidityManager by setting the LSPS2ClientConfig and set it as your CustomMessageHandler in MessagHandler that you give to PeerManager
- Set ChannelConfig:: accept_underpaying_htlcs to true and ChannelHandshakeConfig::max_inbound_value_in_flight_percent_of_channel to 100.
- Start handling LiquidityManager events (returned via next_event, next_event_async, or wait_next_event)
- Connect to the LSP
- Call LiquidityManager::lsps2_client_handler to get an LSPS2ClientHandler
- Call LSPS2ClientHandler::request_opening_params, you'll get an OpeningParametersReady event when the LSP responds
- Pick one of the opening parameters and remember them (to later check if the LSP just takes the fee you agreed on)
- Call LSPS2ClientHandler::select_opening_parameters, you'll get an InvoiceParametersReady event when the LSP responds
- Create a JIT invoice with the information given in said InvoiceParametersReady event
- Hand out that invoice, once it's paid, the LSP will open a channel to you and forward the HTLC
- In your event handling logic for the PaymentClaimable event, check that the LSP only withheld what you agreed upon above (you can use the compute_opening_fee util for that)
- Claim the payment if the LSP didn't cheat you
Note: This is for LSPS2
Metadata
Metadata
Assignees
Labels
No labels