@@ -27,25 +27,17 @@ use core::default::Default;
2727use core:: ops:: Deref ;
2828
2929use crate :: lsps2:: msgs:: {
30- BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , LSPS2Message ,
31- LSPS2Request , LSPS2Response , OpeningFeeParams ,
30+ BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , LSPS2Message , LSPS2Request ,
31+ LSPS2Response , OpeningFeeParams ,
3232} ;
3333
3434/// Client-side configuration options for JIT channels.
3535#[ derive( Clone , Debug , Copy ) ]
36- pub struct LSPS2ClientConfig {
37- /// Trust the LSP to create a valid channel funding transaction and have it confirmed on-chain.
38- ///
39- /// TODO: If set to `false`, we'll only release the pre-image after we see an on-chain
40- /// confirmation of the channel's funding transaction.
41- ///
42- /// Defaults to `true`.
43- pub client_trusts_lsp : bool ,
44- }
36+ pub struct LSPS2ClientConfig { }
4537
4638impl Default for LSPS2ClientConfig {
4739 fn default ( ) -> Self {
48- Self { client_trusts_lsp : true }
40+ Self { }
4941 }
5042}
5143
@@ -73,6 +65,12 @@ impl PeerState {
7365}
7466
7567/// The main object allowing to send and receive LSPS2 messages.
68+ ///
69+ /// Note that currently only the 'client-trusts-LSP' trust model is supported, i.e., we don't
70+ /// provide any additional API guidance to allow withholding the preimage until the channel is
71+ /// opened. Please refer to the [`LSPS2 specification`] for more information.
72+ ///
73+ /// [`LSPS2 specification`]: https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#trust-models
7674pub struct LSPS2ClientHandler < ES : Deref >
7775where
7876 ES :: Target : EntropySource ,
8179 pending_messages : Arc < MessageQueue > ,
8280 pending_events : Arc < EventQueue > ,
8381 per_peer_state : RwLock < HashMap < PublicKey , Mutex < PeerState > > > ,
84- config : LSPS2ClientConfig ,
82+ _config : LSPS2ClientConfig ,
8583}
8684
8785impl < ES : Deref > LSPS2ClientHandler < ES >
@@ -91,14 +89,14 @@ where
9189 /// Constructs an `LSPS2ClientHandler`.
9290 pub ( crate ) fn new (
9391 entropy_source : ES , pending_messages : Arc < MessageQueue > , pending_events : Arc < EventQueue > ,
94- config : LSPS2ClientConfig ,
92+ _config : LSPS2ClientConfig ,
9593 ) -> Self {
9694 Self {
9795 entropy_source,
9896 pending_messages,
9997 pending_events,
10098 per_peer_state : RwLock :: new ( HashMap :: new ( ) ) ,
101- config ,
99+ _config ,
102100 }
103101 }
104102
@@ -276,17 +274,6 @@ where
276274 action : ErrorAction :: IgnoreAndLog ( Level :: Info ) ,
277275 } ) ?;
278276
279- // Reject the buy response if we disallow client_trusts_lsp and the LSP requires
280- // it.
281- if !self . config . client_trusts_lsp && result. client_trusts_lsp {
282- return Err ( LightningError {
283- err : format ! (
284- "Aborting JIT channel flow as the LSP requires 'client_trusts_lsp' mode, which we disallow"
285- ) ,
286- action : ErrorAction :: IgnoreAndLog ( Level :: Info ) ,
287- } ) ;
288- }
289-
290277 if let Ok ( intercept_scid) = result. intercept_scid . to_scid ( ) {
291278 self . pending_events . enqueue ( Event :: LSPS2Client (
292279 LSPS2ClientEvent :: InvoiceParametersReady {
@@ -336,7 +323,7 @@ where
336323 Ok ( ( ) )
337324 }
338325 None => {
339- return Err ( LightningError { err : format ! ( "Received error response for a buy request from an unknown counterparty ({:?})" , counterparty_node_id) , action : ErrorAction :: IgnoreAndLog ( Level :: Info ) } ) ;
326+ return Err ( LightningError { err : format ! ( "Received error response for a buy request from an unknown counterparty ({:?})" , counterparty_node_id) , action : ErrorAction :: IgnoreAndLog ( Level :: Info ) } ) ;
340327 }
341328 }
342329 }
0 commit comments