@@ -27,25 +27,17 @@ use core::default::Default;
27
27
use core:: ops:: Deref ;
28
28
29
29
use crate :: lsps2:: msgs:: {
30
- BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , LSPS2Message ,
31
- LSPS2Request , LSPS2Response , OpeningFeeParams ,
30
+ BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , LSPS2Message , LSPS2Request ,
31
+ LSPS2Response , OpeningFeeParams ,
32
32
} ;
33
33
34
34
/// Client-side configuration options for JIT channels.
35
35
#[ 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 { }
45
37
46
38
impl Default for LSPS2ClientConfig {
47
39
fn default ( ) -> Self {
48
- Self { client_trusts_lsp : true }
40
+ Self { }
49
41
}
50
42
}
51
43
@@ -73,6 +65,12 @@ impl PeerState {
73
65
}
74
66
75
67
/// 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
76
74
pub struct LSPS2ClientHandler < ES : Deref >
77
75
where
78
76
ES :: Target : EntropySource ,
81
79
pending_messages : Arc < MessageQueue > ,
82
80
pending_events : Arc < EventQueue > ,
83
81
per_peer_state : RwLock < HashMap < PublicKey , Mutex < PeerState > > > ,
84
- config : LSPS2ClientConfig ,
82
+ _config : LSPS2ClientConfig ,
85
83
}
86
84
87
85
impl < ES : Deref > LSPS2ClientHandler < ES >
@@ -91,14 +89,14 @@ where
91
89
/// Constructs an `LSPS2ClientHandler`.
92
90
pub ( crate ) fn new (
93
91
entropy_source : ES , pending_messages : Arc < MessageQueue > , pending_events : Arc < EventQueue > ,
94
- config : LSPS2ClientConfig ,
92
+ _config : LSPS2ClientConfig ,
95
93
) -> Self {
96
94
Self {
97
95
entropy_source,
98
96
pending_messages,
99
97
pending_events,
100
98
per_peer_state : RwLock :: new ( HashMap :: new ( ) ) ,
101
- config ,
99
+ _config ,
102
100
}
103
101
}
104
102
@@ -276,17 +274,6 @@ where
276
274
action : ErrorAction :: IgnoreAndLog ( Level :: Info ) ,
277
275
} ) ?;
278
276
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
-
290
277
if let Ok ( intercept_scid) = result. intercept_scid . to_scid ( ) {
291
278
self . pending_events . enqueue ( Event :: LSPS2Client (
292
279
LSPS2ClientEvent :: InvoiceParametersReady {
@@ -336,7 +323,7 @@ where
336
323
Ok ( ( ) )
337
324
}
338
325
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 ) } ) ;
340
327
}
341
328
}
342
329
}
0 commit comments