@@ -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 ) ]
@@ -337,7 +345,8 @@ impl NodeBuilder {
337345
338346 let liquidity_source_config =
339347 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
340- liquidity_source_config. lsps1_service = Some ( ( node_id, address, token) ) ;
348+ let lsps1_client_config = LSPS1ClientConfig { node_id, address, token } ;
349+ liquidity_source_config. lsps1_client = Some ( lsps1_client_config) ;
341350 self
342351 }
343352
@@ -357,7 +366,8 @@ impl NodeBuilder {
357366
358367 let liquidity_source_config =
359368 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
360- liquidity_source_config. lsps2_service = Some ( ( node_id, address, token) ) ;
369+ let lsps2_client_config = LSPS2ClientConfig { node_id, address, token } ;
370+ liquidity_source_config. lsps2_client = Some ( lsps2_client_config) ;
361371 self
362372 }
363373
@@ -1032,7 +1042,7 @@ fn build_with_store_internal(
10321042 } ;
10331043
10341044 let mut user_config = default_user_config ( & config) ;
1035- if liquidity_source_config. and_then ( |lsc| lsc. lsps2_service . as_ref ( ) ) . is_some ( ) {
1045+ if liquidity_source_config. and_then ( |lsc| lsc. lsps2_client . as_ref ( ) ) . is_some ( ) {
10361046 // Generally allow claiming underpaying HTLCs as the LSP will skim off some fee. We'll
10371047 // check that they don't take too much before claiming.
10381048 user_config. channel_config . accept_underpaying_htlcs = true ;
@@ -1173,12 +1183,20 @@ fn build_with_store_internal(
11731183 Arc :: clone ( & logger) ,
11741184 ) ;
11751185
1176- lsc. lsps1_service . as_ref ( ) . map ( |( node_id, address, token) | {
1177- liquidity_source_builder. lsps1_service ( * node_id, address. clone ( ) , token. clone ( ) )
1186+ lsc. lsps1_client . as_ref ( ) . map ( |config| {
1187+ liquidity_source_builder. lsps1_client (
1188+ config. node_id ,
1189+ config. address . clone ( ) ,
1190+ config. token . clone ( ) ,
1191+ )
11781192 } ) ;
11791193
1180- lsc. lsps2_service . as_ref ( ) . map ( |( node_id, address, token) | {
1181- liquidity_source_builder. lsps2_service ( * node_id, address. clone ( ) , token. clone ( ) )
1194+ lsc. lsps2_client . as_ref ( ) . map ( |config| {
1195+ liquidity_source_builder. lsps2_client (
1196+ config. node_id ,
1197+ config. address . clone ( ) ,
1198+ config. token . clone ( ) ,
1199+ )
11821200 } ) ;
11831201
11841202 Arc :: new ( liquidity_source_builder. build ( ) )
0 commit comments