@@ -91,18 +91,26 @@ enum GossipSourceConfig {
9191 RapidGossipSync ( String ) ,
9292}
9393
94- #[ derive( Debug , Clone ) ]
94+ #[ derive( Debug , Clone , Default ) ]
9595struct LiquiditySourceConfig {
96- // LSPS1 service's (node_id, address, token)
97- lsps1_service : Option < ( PublicKey , SocketAddress , Option < String > ) > ,
98- // LSPS2 service's (node_id, address, token)
99- lsps2_service : Option < ( PublicKey , SocketAddress , Option < String > ) > ,
96+ // Act as an LSPS1 client connecting to the given service.
97+ lsps1_client : Option < LSPS1ClientConfig > ,
98+ // Act as an LSPS2 client connecting to the given service.
99+ lsps2_client : Option < LSPS2ClientConfig > ,
100100}
101101
102- impl Default for LiquiditySourceConfig {
103- fn default ( ) -> Self {
104- Self { lsps1_service : None , lsps2_service : None }
105- }
102+ #[ derive( Debug , Clone ) ]
103+ struct LSPS1ClientConfig {
104+ node_id : PublicKey ,
105+ address : SocketAddress ,
106+ token : Option < String > ,
107+ }
108+
109+ #[ derive( Debug , Clone ) ]
110+ struct LSPS2ClientConfig {
111+ node_id : PublicKey ,
112+ address : SocketAddress ,
113+ token : Option < String > ,
106114}
107115
108116/// An error encountered during building a [`Node`].
@@ -287,7 +295,8 @@ impl NodeBuilder {
287295
288296 let liquidity_source_config =
289297 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
290- liquidity_source_config. lsps1_service = Some ( ( node_id, address, token) ) ;
298+ let lsps1_client_config = LSPS1ClientConfig { node_id, address, token } ;
299+ liquidity_source_config. lsps1_client = Some ( lsps1_client_config) ;
291300 self
292301 }
293302
@@ -306,7 +315,8 @@ impl NodeBuilder {
306315
307316 let liquidity_source_config =
308317 self . liquidity_source_config . get_or_insert ( LiquiditySourceConfig :: default ( ) ) ;
309- liquidity_source_config. lsps2_service = Some ( ( node_id, address, token) ) ;
318+ let lsps2_client_config = LSPS2ClientConfig { node_id, address, token } ;
319+ liquidity_source_config. lsps2_client = Some ( lsps2_client_config) ;
310320 self
311321 }
312322
@@ -955,7 +965,7 @@ fn build_with_store_internal(
955965 } ;
956966
957967 let mut user_config = default_user_config ( & config) ;
958- if liquidity_source_config. and_then ( |lsc| lsc. lsps2_service . as_ref ( ) ) . is_some ( ) {
968+ if liquidity_source_config. and_then ( |lsc| lsc. lsps2_client . as_ref ( ) ) . is_some ( ) {
959969 // Generally allow claiming underpaying HTLCs as the LSP will skim off some fee. We'll
960970 // check that they don't take too much before claiming.
961971 user_config. channel_config . accept_underpaying_htlcs = true ;
@@ -1092,12 +1102,20 @@ fn build_with_store_internal(
10921102 Arc :: clone ( & logger) ,
10931103 ) ;
10941104
1095- lsc. lsps1_service . as_ref ( ) . map ( |( node_id, address, token) | {
1096- liquidity_source_builder. lsps1_service ( * node_id, address. clone ( ) , token. clone ( ) )
1105+ lsc. lsps1_client . as_ref ( ) . map ( |config| {
1106+ liquidity_source_builder. lsps1_client (
1107+ config. node_id ,
1108+ config. address . clone ( ) ,
1109+ config. token . clone ( ) ,
1110+ )
10971111 } ) ;
10981112
1099- lsc. lsps2_service . as_ref ( ) . map ( |( node_id, address, token) | {
1100- liquidity_source_builder. lsps2_service ( * node_id, address. clone ( ) , token. clone ( ) )
1113+ lsc. lsps2_client . as_ref ( ) . map ( |config| {
1114+ liquidity_source_builder. lsps2_client (
1115+ config. node_id ,
1116+ config. address . clone ( ) ,
1117+ config. token . clone ( ) ,
1118+ )
11011119 } ) ;
11021120
11031121 Arc :: new ( liquidity_source_builder. build ( ) )
0 commit comments