Struct LSPS2ServiceHandler

Source
pub struct LSPS2ServiceHandler<CM: Deref + Clone>{ /* private fields */ }
Expand description

The main object allowing to send and receive LSPS2 messages.

Implementations§

Source§

impl<CM: Deref + Clone> LSPS2ServiceHandler<CM>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<CM> !Freeze for LSPS2ServiceHandler<CM>

§

impl<CM> RefUnwindSafe for LSPS2ServiceHandler<CM>
where CM: RefUnwindSafe,

§

impl<CM> Send for LSPS2ServiceHandler<CM>
where CM: Send,

§

impl<CM> Sync for LSPS2ServiceHandler<CM>
where CM: Sync,

§

impl<CM> Unpin for LSPS2ServiceHandler<CM>
where CM: Unpin,

§

impl<CM> UnwindSafe for LSPS2ServiceHandler<CM>
where CM: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.