@@ -30,37 +30,34 @@ pub(crate) trait ProtocolMessageHandler {
30
30
) -> Result < ( ) , LightningError > ;
31
31
}
32
32
33
- /// A configuration for [`LSPManager `].
33
+ /// A configuration for [`LiquidityManager `].
34
34
///
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 ;
41
38
42
39
/// The main interface into LSP functionality.
43
40
///
44
41
/// Should be used as a [`CustomMessageHandler`] for your
45
42
/// [`lightning::ln::peer_handler::PeerManager`]'s [`lightning::ln::peer_handler::MessageHandler`].
46
- pub struct LSPManager < ES : Deref >
43
+ pub struct LiquidityManager < ES : Deref >
47
44
where
48
45
ES :: Target : EntropySource ,
49
46
{
50
47
pending_messages : Arc < Mutex < Vec < ( PublicKey , LSPSMessage ) > > > ,
51
48
request_id_to_method_map : Mutex < HashMap < String , String > > ,
52
49
lsps0_message_handler : LSPS0MessageHandler < ES > ,
53
- config : LSPConfig ,
50
+ provider_config : Option < LiquidityProviderConfig > ,
54
51
}
55
52
56
- impl < ES : Deref > LSPManager < ES >
53
+ impl < ES : Deref > LiquidityManager < ES >
57
54
where
58
55
ES :: Target : EntropySource ,
59
56
{
60
- /// Constructor for the LSPManager
57
+ /// Constructor for the LiquidityManager
61
58
///
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 {
64
61
let pending_messages = Arc :: new ( Mutex :: new ( vec ! [ ] ) ) ;
65
62
66
63
let lsps0_message_handler =
70
67
pending_messages,
71
68
request_id_to_method_map : Mutex :: new ( HashMap :: new ( ) ) ,
72
69
lsps0_message_handler,
73
- config ,
70
+ provider_config ,
74
71
}
75
72
}
76
73
94
91
}
95
92
}
96
93
97
- impl < ES : Deref > CustomMessageReader for LSPManager < ES >
94
+ impl < ES : Deref > CustomMessageReader for LiquidityManager < ES >
98
95
where
99
96
ES :: Target : EntropySource ,
100
97
{
@@ -110,7 +107,7 @@ where
110
107
}
111
108
}
112
109
113
- impl < ES : Deref > CustomMessageHandler for LSPManager < ES >
110
+ impl < ES : Deref > CustomMessageHandler for LiquidityManager < ES >
114
111
where
115
112
ES :: Target : EntropySource ,
116
113
{
@@ -149,7 +146,7 @@ where
149
146
fn provided_node_features ( & self ) -> NodeFeatures {
150
147
let mut features = NodeFeatures :: empty ( ) ;
151
148
152
- if self . config . is_lsp {
149
+ if self . provider_config . is_some ( ) {
153
150
features. set_optional_custom_bit ( LSPS_FEATURE_BIT ) . unwrap ( ) ;
154
151
}
155
152
@@ -159,7 +156,7 @@ where
159
156
fn provided_init_features ( & self , _their_node_id : & PublicKey ) -> InitFeatures {
160
157
let mut features = InitFeatures :: empty ( ) ;
161
158
162
- if self . config . is_lsp {
159
+ if self . provider_config . is_some ( ) {
163
160
features. set_optional_custom_bit ( LSPS_FEATURE_BIT ) . unwrap ( ) ;
164
161
}
165
162
0 commit comments