@@ -94,18 +94,26 @@ enum GossipSourceConfig {
9494 RapidGossipSync ( String ) ,
9595}
9696
97- #[ derive( Debug , Clone ) ]
97+ #[ derive( Debug , Clone , Default ) ]
9898struct LiquiditySourceConfig {
99- // LSPS1 service's (node_id, address, token)
100- lsps1_service : Option < ( PublicKey , SocketAddress , Option < String > ) > ,
101- // LSPS2 service's (node_id, address, token)
102- lsps2_service : Option < ( PublicKey , SocketAddress , Option < String > ) > ,
99+ // Act as an LSPS1 client connecting to the given service.
100+ lsps1_client : Option < LSPS1ClientConfig > ,
101+ // Act as an LSPS2 client connecting to the given service.
102+ lsps2_client : Option < LSPS2ClientConfig > ,
103103}
104104
105- impl Default for LiquiditySourceConfig {
106- fn default ( ) -> Self {
107- Self { lsps1_service : None , lsps2_service : None }
108- }
105+ #[ derive( Debug , Clone ) ]
106+ struct LSPS1ClientConfig {
107+ node_id : PublicKey ,
108+ address : SocketAddress ,
109+ token : Option < String > ,
110+ }
111+
112+ #[ derive( Debug , Clone ) ]
113+ struct LSPS2ClientConfig {
114+ node_id : PublicKey ,
115+ address : SocketAddress ,
116+ token : Option < String > ,
109117}
110118
111119#[ derive( Clone ) ]
@@ -317,7 +325,8 @@ impl NodeBuilder {
317325
318326 let liquidity_source_config =
319327 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
320- liquidity_source_config. lsps1_service = Some ( ( node_id, address, token) ) ;
328+ let lsps1_client_config = LSPS1ClientConfig { node_id, address, token } ;
329+ liquidity_source_config. lsps1_client = Some ( lsps1_client_config) ;
321330 self
322331 }
323332
@@ -337,7 +346,8 @@ impl NodeBuilder {
337346
338347 let liquidity_source_config =
339348 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
340- liquidity_source_config. lsps2_service = Some ( ( node_id, address, token) ) ;
349+ let lsps2_client_config = LSPS2ClientConfig { node_id, address, token } ;
350+ liquidity_source_config. lsps2_client = Some ( lsps2_client_config) ;
341351 self
342352 }
343353
@@ -1027,7 +1037,7 @@ fn build_with_store_internal(
10271037 } ;
10281038
10291039 let mut user_config = default_user_config ( & config) ;
1030- if liquidity_source_config. and_then ( |lsc| lsc. lsps2_service . as_ref ( ) ) . is_some ( ) {
1040+ if liquidity_source_config. and_then ( |lsc| lsc. lsps2_client . as_ref ( ) ) . is_some ( ) {
10311041 // Generally allow claiming underpaying HTLCs as the LSP will skim off some fee. We'll
10321042 // check that they don't take too much before claiming.
10331043 user_config. channel_config . accept_underpaying_htlcs = true ;
@@ -1168,12 +1178,20 @@ fn build_with_store_internal(
11681178 Arc :: clone ( & logger) ,
11691179 ) ;
11701180
1171- lsc. lsps1_service . as_ref ( ) . map ( |( node_id, address, token) | {
1172- liquidity_source_builder. lsps1_service ( * node_id, address. clone ( ) , token. clone ( ) )
1181+ lsc. lsps1_client . as_ref ( ) . map ( |config| {
1182+ liquidity_source_builder. lsps1_client (
1183+ config. node_id ,
1184+ config. address . clone ( ) ,
1185+ config. token . clone ( ) ,
1186+ )
11731187 } ) ;
11741188
1175- lsc. lsps2_service . as_ref ( ) . map ( |( node_id, address, token) | {
1176- liquidity_source_builder. lsps2_service ( * node_id, address. clone ( ) , token. clone ( ) )
1189+ lsc. lsps2_client . as_ref ( ) . map ( |config| {
1190+ liquidity_source_builder. lsps2_client (
1191+ config. node_id ,
1192+ config. address . clone ( ) ,
1193+ config. token . clone ( ) ,
1194+ )
11771195 } ) ;
11781196
11791197 Arc :: new ( liquidity_source_builder. build ( ) )
0 commit comments