pub struct LSPS2ServiceHandler<CM: Deref + Clone>where
CM::Target: AChannelManager,{ /* private fields */ }
Expand description
The main object allowing to send and receive LSPS2 messages.
Implementations§
Source§impl<CM: Deref + Clone> LSPS2ServiceHandler<CM>where
CM::Target: AChannelManager,
impl<CM: Deref + Clone> LSPS2ServiceHandler<CM>where
CM::Target: AChannelManager,
Sourcepub fn invalid_token_provided(
&self,
counterparty_node_id: &PublicKey,
request_id: RequestId,
) -> Result<(), APIError>
pub fn invalid_token_provided( &self, counterparty_node_id: &PublicKey, request_id: RequestId, ) -> Result<(), APIError>
Used by LSP to inform a client requesting a JIT Channel the token they used is invalid.
Should be called in response to receiving a LSPS2ServiceEvent::GetInfo
event.
Sourcepub fn opening_fee_params_generated(
&self,
counterparty_node_id: &PublicKey,
request_id: RequestId,
opening_fee_params_menu: Vec<RawOpeningFeeParams>,
) -> Result<(), APIError>
pub fn opening_fee_params_generated( &self, counterparty_node_id: &PublicKey, request_id: RequestId, opening_fee_params_menu: Vec<RawOpeningFeeParams>, ) -> Result<(), APIError>
Used by LSP to provide fee parameters to a client requesting a JIT Channel.
Should be called in response to receiving a LSPS2ServiceEvent::GetInfo
event.
Sourcepub fn invoice_parameters_generated(
&self,
counterparty_node_id: &PublicKey,
request_id: RequestId,
intercept_scid: u64,
cltv_expiry_delta: u32,
client_trusts_lsp: bool,
user_channel_id: u128,
) -> Result<(), APIError>
pub fn invoice_parameters_generated( &self, counterparty_node_id: &PublicKey, request_id: RequestId, intercept_scid: u64, cltv_expiry_delta: u32, client_trusts_lsp: bool, user_channel_id: u128, ) -> Result<(), APIError>
Used by LSP to provide client with the intercept scid and cltv_expiry_delta to use in their invoice.
Should be called in response to receiving a LSPS2ServiceEvent::BuyRequest
event.
Sourcepub fn htlc_intercepted(
&self,
intercept_scid: u64,
intercept_id: InterceptId,
expected_outbound_amount_msat: u64,
payment_hash: PaymentHash,
) -> Result<(), APIError>
pub fn htlc_intercepted( &self, intercept_scid: u64, intercept_id: InterceptId, expected_outbound_amount_msat: u64, payment_hash: PaymentHash, ) -> Result<(), APIError>
Forward Event::HTLCIntercepted
event parameters into this function.
Will fail the intercepted HTLC if the intercept scid matches a payment we are expecting but the payment amount is incorrect or the expiry has passed.
Will generate a LSPS2ServiceEvent::OpenChannel
event if the intercept scid matches a payment we are expected
and the payment amount is correct and the offer has not expired.
Will do nothing if the intercept scid does not match any of the ones we gave out.
Sourcepub fn htlc_handling_failed(
&self,
failed_next_destination: HTLCDestination,
) -> Result<(), APIError>
pub fn htlc_handling_failed( &self, failed_next_destination: HTLCDestination, ) -> Result<(), APIError>
Forward Event::HTLCHandlingFailed
event parameter into this function.
Will attempt to forward the next payment in the queue if one is present. Will do nothing if the intercept scid does not match any of the ones we gave out or if the payment queue is empty
Sourcepub fn payment_forwarded(
&self,
next_channel_id: ChannelId,
) -> Result<(), APIError>
pub fn payment_forwarded( &self, next_channel_id: ChannelId, ) -> Result<(), APIError>
Forward Event::PaymentForwarded
event parameter into this function.
Will register the forwarded payment as having paid the JIT channel fee, and forward any held
and future HTLCs for the SCID of the initial invoice. In the future, this will verify the
skimmed_fee_msat
in Event::PaymentForwarded
.
Note that next_channel_id
is required to be provided. Therefore, the corresponding
Event::PaymentForwarded
events need to be generated and serialized by LDK versions
greater or equal to 0.0.107.
Sourcepub fn channel_ready(
&self,
user_channel_id: u128,
channel_id: &ChannelId,
counterparty_node_id: &PublicKey,
) -> Result<(), APIError>
pub fn channel_ready( &self, user_channel_id: u128, channel_id: &ChannelId, counterparty_node_id: &PublicKey, ) -> Result<(), APIError>
Forward Event::ChannelReady
event parameters into this function.
Will forward the intercepted HTLC if it matches a channel we need to forward a payment over otherwise it will be ignored.