Skip to content

lightning-liquidity: Add config accessors #3589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lightning-liquidity/src/lsps1/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
pending_messages: Arc<MessageQueue>,
pending_events: Arc<EventQueue>,
per_peer_state: RwLock<HashMap<PublicKey, Mutex<PeerState>>>,
_config: LSPS1ClientConfig,
config: LSPS1ClientConfig,
}

impl<ES: Deref> LSPS1ClientHandler<ES>
Expand All @@ -71,10 +71,15 @@ where
pending_messages,
pending_events,
per_peer_state: RwLock::new(new_hash_map()),
_config: config,
config,
}
}

/// Returns a reference to the used config.
pub fn config(&self) -> &LSPS1ClientConfig {
&self.config
}

/// Request the supported options from the LSP.
///
/// The user will receive the LSP's response via an [`SupportedOptionsReady`] event.
Expand Down
5 changes: 5 additions & 0 deletions lightning-liquidity/src/lsps1/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ where
}
}

/// Returns a reference to the used config.
pub fn config(&self) -> &LSPS1ServiceConfig {
&self.config
}

fn handle_get_info_request(
&self, request_id: LSPSRequestId, counterparty_node_id: &PublicKey,
) -> Result<(), LightningError> {
Expand Down
11 changes: 8 additions & 3 deletions lightning-liquidity/src/lsps2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
pending_messages: Arc<MessageQueue>,
pending_events: Arc<EventQueue>,
per_peer_state: RwLock<HashMap<PublicKey, Mutex<PeerState>>>,
_config: LSPS2ClientConfig,
config: LSPS2ClientConfig,
}

impl<ES: Deref> LSPS2ClientHandler<ES>
Expand All @@ -82,17 +82,22 @@ where
/// Constructs an `LSPS2ClientHandler`.
pub(crate) fn new(
entropy_source: ES, pending_messages: Arc<MessageQueue>, pending_events: Arc<EventQueue>,
_config: LSPS2ClientConfig,
config: LSPS2ClientConfig,
) -> Self {
Self {
entropy_source,
pending_messages,
pending_events,
per_peer_state: RwLock::new(new_hash_map()),
_config,
config,
}
}

/// Returns a reference to the used config.
pub fn config(&self) -> &LSPS2ClientConfig {
&self.config
}

/// Request the channel opening parameters from the LSP.
///
/// This initiates the JIT-channel flow that, at the end of it, will have the LSP
Expand Down
5 changes: 5 additions & 0 deletions lightning-liquidity/src/lsps2/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ where
}
}

/// Returns a reference to the used config.
pub fn config(&self) -> &LSPS2ServiceConfig {
&self.config
}

/// 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.
Expand Down
Loading