LiquidityManagerSync

Struct LiquidityManagerSync 

Source
pub struct LiquidityManagerSync<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone>{ /* private fields */ }
Expand description

A synchroneous wrapper around LiquidityManager to be used in contexts where async is not available.

Implementations§

Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, T: Deref + Clone> LiquidityManagerSync<ES, NS, CM, C, KS, DefaultTimeProvider, T>

Source

pub fn new( entropy_source: ES, node_signer: NS, channel_manager: CM, chain_source: Option<C>, chain_params: Option<ChainParameters>, kv_store_sync: KS, transaction_broadcaster: T, service_config: Option<LiquidityServiceConfig>, client_config: Option<LiquidityClientConfig>, ) -> Result<Self, Error>

Available on crate feature time only.

Constructor for the LiquidityManagerSync using the default system clock

Wraps LiquidityManager::new.

Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source

pub fn new_with_custom_time_provider( entropy_source: ES, node_signer: NS, channel_manager: CM, chain_source: Option<C>, chain_params: Option<ChainParameters>, kv_store_sync: KS, transaction_broadcaster: T, service_config: Option<LiquidityServiceConfig>, client_config: Option<LiquidityClientConfig>, time_provider: TP, ) -> Result<Self, Error>

Constructor for the LiquidityManagerSync with a custom time provider.

Wraps LiquidityManager::new_with_custom_time_provider.

Source

pub fn lsps0_client_handler( &self, ) -> &LSPS0ClientHandler<ES, KVStoreSyncWrapper<KS>>

Returns a reference to the LSPS0 client-side handler.

Wraps LiquidityManager::lsps0_client_handler.

Source

pub fn lsps0_service_handler(&self) -> Option<&LSPS0ServiceHandler>

Returns a reference to the LSPS0 server-side handler.

Wraps LiquidityManager::lsps0_service_handler.

Source

pub fn lsps1_client_handler( &self, ) -> Option<&LSPS1ClientHandler<ES, KVStoreSyncWrapper<KS>>>

Returns a reference to the LSPS1 client-side handler.

Wraps LiquidityManager::lsps1_client_handler.

Source

pub fn lsps2_client_handler( &self, ) -> Option<&LSPS2ClientHandler<ES, KVStoreSyncWrapper<KS>>>

Returns a reference to the LSPS2 client-side handler.

Wraps LiquidityManager::lsps2_client_handler.

Source

pub fn lsps2_service_handler<'a>( &'a self, ) -> Option<LSPS2ServiceHandlerSync<'a, CM, KVStoreSyncWrapper<KS>, T>>

Returns a reference to the LSPS2 server-side handler.

Wraps LiquidityManager::lsps2_service_handler.

Source

pub fn lsps5_client_handler( &self, ) -> Option<&LSPS5ClientHandler<ES, KVStoreSyncWrapper<KS>>>

Returns a reference to the LSPS5 client-side handler.

Wraps LiquidityManager::lsps5_client_handler.

Source

pub fn lsps5_service_handler( &self, ) -> Option<&LSPS5ServiceHandler<CM, NS, KVStoreSyncWrapper<KS>, TP>>

Returns a reference to the LSPS5 server-side handler.

Wraps LiquidityManager::lsps5_service_handler.

Source

pub fn get_pending_msgs_or_needs_persist_future(&self) -> Future

Returns a Future that will complete when the next batch of pending messages is ready to be processed or we need to be repersisted.

Wraps LiquidityManager::get_pending_msgs_or_needs_persist_future.

Source

pub fn wait_next_event(&self) -> LiquidityEvent

Available on crate feature std only.

Blocks the current thread until next event is ready and returns it.

Typically you would spawn a thread or task that calls this in a loop.

Note: Users must handle events as soon as possible to avoid an increased event queue memory footprint. We will start dropping any generated events after MAX_EVENT_QUEUE_SIZE has been reached.

Source

pub fn next_event(&self) -> Option<LiquidityEvent>

Returns Some if an event is ready.

Wraps LiquidityManager::next_event.

Source

pub fn get_and_clear_pending_events(&self) -> Vec<LiquidityEvent>

Returns and clears all events without blocking.

Wraps LiquidityManager::get_and_clear_pending_events.

Source

pub fn persist(&self) -> Result<(), Error>

Persists the state of the service handlers towards the given KVStoreSync implementation.

Wraps LiquidityManager::persist.

Trait Implementations§

Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> ALiquidityManagerSync for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source§

type EntropySource = <ES as Deref>::Target

A type implementing EntropySource
Source§

type ES = ES

A type that may be dereferenced to Self::EntropySource.
Source§

type NodeSigner = <NS as Deref>::Target

A type implementing NodeSigner
Source§

type NS = NS

A type that may be dereferenced to Self::NodeSigner.
Source§

type AChannelManager = <CM as Deref>::Target

A type implementing AChannelManager
Source§

type CM = CM

A type that may be dereferenced to Self::AChannelManager.
Source§

type Filter = <C as Deref>::Target

A type implementing Filter.
Source§

type C = C

A type that may be dereferenced to Self::Filter.
Source§

type KVStoreSync = <KS as Deref>::Target

A type implementing KVStoreSync.
Source§

type KS = KS

A type that may be dereferenced to Self::KVStoreSync.
Source§

type TimeProvider = <TP as Deref>::Target

A type implementing TimeProvider.
Source§

type TP = TP

A type that may be dereferenced to Self::TimeProvider.
Source§

type BroadcasterInterface = <T as Deref>::Target

A type implementing BroadcasterInterface.
Source§

type T = T

A type that may be dereferenced to Self::BroadcasterInterface.
Source§

fn get_lm(&self) -> &LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Returns a reference to the actual LiquidityManager object.
Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> Confirm for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source§

fn transactions_confirmed( &self, header: &Header, txdata: &TransactionData<'_>, height: u32, )

Notifies LDK of transactions confirmed in a block with a given header and height. Read more
Source§

fn transaction_unconfirmed(&self, txid: &Txid)

Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. Read more
Source§

fn best_block_updated(&self, header: &Header, height: u32)

Notifies LDK of an update to the best header connected at the given height. Read more
Source§

fn get_relevant_txids(&self) -> Vec<(Txid, u32, Option<BlockHash>)>

Returns transactions that must be monitored for reorganization out of the chain along with the height and the hash of the block as part of which it had been previously confirmed. Read more
Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> CustomMessageHandler for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source§

fn handle_custom_message( &self, msg: Self::CustomMessage, sender_node_id: PublicKey, ) -> Result<(), LightningError>

Handles the given message sent from sender_node_id, possibly producing messages for CustomMessageHandler::get_and_clear_pending_msg to return and thus for PeerManager to send.
Source§

fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)>

Returns the list of pending messages that were generated by the handler, clearing the list in the process. Each message is paired with the node id of the intended recipient. If no connection to the node exists, then the message is simply not sent.
Source§

fn provided_node_features(&self) -> NodeFeatures

Gets the node feature flags which this handler itself supports. All available handlers are queried similarly and their feature flags are OR’d together to form the NodeFeatures which are broadcasted in our NodeAnnouncement message.
Source§

fn provided_init_features(&self, their_node_id: PublicKey) -> InitFeatures

Gets the init feature flags which should be sent to the given peer. All available handlers are queried similarly and their feature flags are OR’d together to form the InitFeatures which are sent in our Init message.
Source§

fn peer_disconnected(&self, counterparty_node_id: PublicKey)

Indicates a peer disconnected.
Source§

fn peer_connected( &self, counterparty_node_id: PublicKey, init_msg: &Init, inbound: bool, ) -> Result<(), ()>

Handle a peer connecting. Read more
Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> CustomMessageReader for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source§

type CustomMessage = RawLSPSMessage

The type of the message decoded by the implementation.
Source§

fn read<RD: LengthLimitedRead>( &self, message_type: u16, buffer: &mut RD, ) -> Result<Option<Self::CustomMessage>, DecodeError>

Decodes a custom message to CustomMessageType. If the given message type is known to the implementation and the message could be decoded, must return Ok(Some(message)). If the message type is unknown to the implementation, must return Ok(None). If a decoding error occur, must return Err(DecodeError::X) where X details the encountered error.
Source§

impl<ES: Deref + Clone, NS: Deref + Clone, CM: Deref + Clone, C: Deref + Clone, KS: Deref + Clone, TP: Deref + Clone, T: Deref + Clone> Listen for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

Source§

fn filtered_block_connected( &self, header: &Header, txdata: &TransactionData<'_>, height: u32, )

Notifies the listener that a block was added at the given height, with the transaction data possibly filtered.
Source§

fn blocks_disconnected(&self, fork_point: BestBlock)

Notifies the listener that one or more blocks were removed in anticipation of a reorg. Read more
Source§

fn block_connected(&self, block: &Block, height: u32)

Notifies the listener that a block was added at the given height.

Auto Trait Implementations§

§

impl<ES, NS, CM, C, KS, TP, T> !Freeze for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

§

impl<ES, NS, CM, C, KS, TP, T> RefUnwindSafe for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

§

impl<ES, NS, CM, C, KS, TP, T> Send for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
where ES: Send, C: Send, CM: Send, T: Send, TP: Send, NS: Send, KS: Sync + Send,

§

impl<ES, NS, CM, C, KS, TP, T> Sync for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
where ES: Sync, C: Sync, CM: Sync, T: Sync, TP: Sync, NS: Sync, KS: Sync + Send,

§

impl<ES, NS, CM, C, KS, TP, T> Unpin for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
where ES: Unpin, C: Unpin, CM: Unpin, T: Unpin, TP: Unpin, NS: Unpin, KS: Unpin,

§

impl<ES, NS, CM, C, KS, TP, T> UnwindSafe for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>

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.