Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit f8eb772

Browse files
rename LSP objects using more descriptive name
1 parent 6d3c888 commit f8eb772

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ mod jit_channel;
2323
mod transport;
2424
mod utils;
2525

26-
pub use transport::message_handler::{LSPConfig, LSPManager};
26+
pub use transport::message_handler::{LiquidityManager, LiquidityProviderConfig};

src/transport/message_handler.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,34 @@ pub(crate) trait ProtocolMessageHandler {
3030
) -> Result<(), LightningError>;
3131
}
3232

33-
/// A configuration for [`LSPManager`].
33+
/// A configuration for [`LiquidityManager`].
3434
///
35-
/// Allows end-user to configure options for both client and server
36-
/// usage of the [`LSPManager`].
37-
pub struct LSPConfig {
38-
/// Indicates whether or not you intend to provide services.
39-
is_lsp: bool,
40-
}
35+
/// Allows end-user to configure options when using the [`LiquidityManager`]
36+
/// to provide liquidity services to clients.
37+
pub struct LiquidityProviderConfig;
4138

4239
/// The main interface into LSP functionality.
4340
///
4441
/// Should be used as a [`CustomMessageHandler`] for your
4542
/// [`lightning::ln::peer_handler::PeerManager`]'s [`lightning::ln::peer_handler::MessageHandler`].
46-
pub struct LSPManager<ES: Deref>
43+
pub struct LiquidityManager<ES: Deref>
4744
where
4845
ES::Target: EntropySource,
4946
{
5047
pending_messages: Arc<Mutex<Vec<(PublicKey, LSPSMessage)>>>,
5148
request_id_to_method_map: Mutex<HashMap<String, String>>,
5249
lsps0_message_handler: LSPS0MessageHandler<ES>,
53-
config: LSPConfig,
50+
provider_config: Option<LiquidityProviderConfig>,
5451
}
5552

56-
impl<ES: Deref> LSPManager<ES>
53+
impl<ES: Deref> LiquidityManager<ES>
5754
where
5855
ES::Target: EntropySource,
5956
{
60-
/// Constructor for the LSPManager
57+
/// Constructor for the LiquidityManager
6158
///
62-
/// Sets up the required protocol message handlers based on the given [`LSPConfig`].
63-
pub fn new(entropy_source: ES, config: LSPConfig) -> Self {
59+
/// Sets up the required protocol message handlers based on the given [`LiquidityProviderConfig`].
60+
pub fn new(entropy_source: ES, provider_config: Option<LiquidityProviderConfig>) -> Self {
6461
let pending_messages = Arc::new(Mutex::new(vec![]));
6562

6663
let lsps0_message_handler =
@@ -70,7 +67,7 @@ where
7067
pending_messages,
7168
request_id_to_method_map: Mutex::new(HashMap::new()),
7269
lsps0_message_handler,
73-
config,
70+
provider_config,
7471
}
7572
}
7673

@@ -94,7 +91,7 @@ where
9491
}
9592
}
9693

97-
impl<ES: Deref> CustomMessageReader for LSPManager<ES>
94+
impl<ES: Deref> CustomMessageReader for LiquidityManager<ES>
9895
where
9996
ES::Target: EntropySource,
10097
{
@@ -110,7 +107,7 @@ where
110107
}
111108
}
112109

113-
impl<ES: Deref> CustomMessageHandler for LSPManager<ES>
110+
impl<ES: Deref> CustomMessageHandler for LiquidityManager<ES>
114111
where
115112
ES::Target: EntropySource,
116113
{
@@ -149,7 +146,7 @@ where
149146
fn provided_node_features(&self) -> NodeFeatures {
150147
let mut features = NodeFeatures::empty();
151148

152-
if self.config.is_lsp {
149+
if self.provider_config.is_some() {
153150
features.set_optional_custom_bit(LSPS_FEATURE_BIT).unwrap();
154151
}
155152

@@ -159,7 +156,7 @@ where
159156
fn provided_init_features(&self, _their_node_id: &PublicKey) -> InitFeatures {
160157
let mut features = InitFeatures::empty();
161158

162-
if self.config.is_lsp {
159+
if self.provider_config.is_some() {
163160
features.set_optional_custom_bit(LSPS_FEATURE_BIT).unwrap();
164161
}
165162

0 commit comments

Comments
 (0)