Skip to content

Commit 3e318ed

Browse files
authored
Merge pull request #3589 from tnull/2025-02-config-accessors
`lightning-liquidity`: Add `config` accessors
2 parents c5fd164 + f93caae commit 3e318ed

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

lightning-liquidity/src/lsps1/client.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ where
5454
pending_messages: Arc<MessageQueue>,
5555
pending_events: Arc<EventQueue>,
5656
per_peer_state: RwLock<HashMap<PublicKey, Mutex<PeerState>>>,
57-
_config: LSPS1ClientConfig,
57+
config: LSPS1ClientConfig,
5858
}
5959

6060
impl<ES: Deref> LSPS1ClientHandler<ES>
@@ -71,10 +71,15 @@ where
7171
pending_messages,
7272
pending_events,
7373
per_peer_state: RwLock::new(new_hash_map()),
74-
_config: config,
74+
config,
7575
}
7676
}
7777

78+
/// Returns a reference to the used config.
79+
pub fn config(&self) -> &LSPS1ClientConfig {
80+
&self.config
81+
}
82+
7883
/// Request the supported options from the LSP.
7984
///
8085
/// The user will receive the LSP's response via an [`SupportedOptionsReady`] event.

lightning-liquidity/src/lsps1/service.rs

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ where
166166
}
167167
}
168168

169+
/// Returns a reference to the used config.
170+
pub fn config(&self) -> &LSPS1ServiceConfig {
171+
&self.config
172+
}
173+
169174
fn handle_get_info_request(
170175
&self, request_id: LSPSRequestId, counterparty_node_id: &PublicKey,
171176
) -> Result<(), LightningError> {

lightning-liquidity/src/lsps2/client.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ where
7272
pending_messages: Arc<MessageQueue>,
7373
pending_events: Arc<EventQueue>,
7474
per_peer_state: RwLock<HashMap<PublicKey, Mutex<PeerState>>>,
75-
_config: LSPS2ClientConfig,
75+
config: LSPS2ClientConfig,
7676
}
7777

7878
impl<ES: Deref> LSPS2ClientHandler<ES>
@@ -82,17 +82,22 @@ where
8282
/// Constructs an `LSPS2ClientHandler`.
8383
pub(crate) fn new(
8484
entropy_source: ES, pending_messages: Arc<MessageQueue>, pending_events: Arc<EventQueue>,
85-
_config: LSPS2ClientConfig,
85+
config: LSPS2ClientConfig,
8686
) -> Self {
8787
Self {
8888
entropy_source,
8989
pending_messages,
9090
pending_events,
9191
per_peer_state: RwLock::new(new_hash_map()),
92-
_config,
92+
config,
9393
}
9494
}
9595

96+
/// Returns a reference to the used config.
97+
pub fn config(&self) -> &LSPS2ClientConfig {
98+
&self.config
99+
}
100+
96101
/// Request the channel opening parameters from the LSP.
97102
///
98103
/// This initiates the JIT-channel flow that, at the end of it, will have the LSP

lightning-liquidity/src/lsps2/service.rs

+5
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ where
586586
}
587587
}
588588

589+
/// Returns a reference to the used config.
590+
pub fn config(&self) -> &LSPS2ServiceConfig {
591+
&self.config
592+
}
593+
589594
/// Used by LSP to inform a client requesting a JIT Channel the token they used is invalid.
590595
///
591596
/// Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event.

0 commit comments

Comments
 (0)