@@ -27,7 +27,7 @@ use core::default::Default;
27
27
use core:: ops:: Deref ;
28
28
29
29
use crate :: lsps2:: msgs:: {
30
- BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , InterceptScid , LSPS2Message ,
30
+ BuyRequest , BuyResponse , GetInfoRequest , GetInfoResponse , LSPS2Message ,
31
31
LSPS2Request , LSPS2Response , OpeningFeeParams ,
32
32
} ;
33
33
@@ -49,51 +49,13 @@ impl Default for LSPS2ClientConfig {
49
49
}
50
50
}
51
51
52
- struct ChannelStateError ( String ) ;
53
-
54
- impl From < ChannelStateError > for LightningError {
55
- fn from ( value : ChannelStateError ) -> Self {
56
- LightningError { err : value. 0 , action : ErrorAction :: IgnoreAndLog ( Level :: Info ) }
57
- }
58
- }
59
-
60
- #[ derive( PartialEq , Debug ) ]
61
- enum InboundJITChannelState {
62
- BuyRequested ,
63
- PendingPayment { client_trusts_lsp : bool , intercept_scid : InterceptScid } ,
64
- }
65
-
66
- impl InboundJITChannelState {
67
- fn invoice_params_received (
68
- & self , client_trusts_lsp : bool , intercept_scid : InterceptScid ,
69
- ) -> Result < Self , ChannelStateError > {
70
- match self {
71
- InboundJITChannelState :: BuyRequested { .. } => {
72
- Ok ( InboundJITChannelState :: PendingPayment { client_trusts_lsp, intercept_scid } )
73
- }
74
- state => Err ( ChannelStateError ( format ! (
75
- "Invoice params received when JIT Channel was in state: {:?}" ,
76
- state
77
- ) ) ) ,
78
- }
79
- }
80
- }
81
-
82
52
struct InboundJITChannel {
83
- state : InboundJITChannelState ,
84
53
payment_size_msat : Option < u64 > ,
85
54
}
86
55
87
56
impl InboundJITChannel {
88
57
fn new ( payment_size_msat : Option < u64 > ) -> Self {
89
- Self { payment_size_msat, state : InboundJITChannelState :: BuyRequested }
90
- }
91
-
92
- fn invoice_params_received (
93
- & mut self , client_trusts_lsp : bool , intercept_scid : InterceptScid ,
94
- ) -> Result < ( ) , LightningError > {
95
- self . state = self . state . invoice_params_received ( client_trusts_lsp, intercept_scid) ?;
96
- Ok ( ( ) )
58
+ Self { payment_size_msat }
97
59
}
98
60
}
99
61
@@ -305,7 +267,7 @@ where
305
267
Some ( inner_state_lock) => {
306
268
let mut peer_state = inner_state_lock. lock ( ) . unwrap ( ) ;
307
269
308
- let mut jit_channel =
270
+ let jit_channel =
309
271
peer_state. pending_buy_requests . remove ( & request_id) . ok_or ( LightningError {
310
272
err : format ! (
311
273
"Received buy response for an unknown request: {:?}" ,
@@ -325,12 +287,6 @@ where
325
287
} ) ;
326
288
}
327
289
328
- // Update the channel state
329
- jit_channel. invoice_params_received (
330
- result. client_trusts_lsp ,
331
- result. intercept_scid . clone ( ) ,
332
- ) ?;
333
-
334
290
if let Ok ( intercept_scid) = result. intercept_scid . to_scid ( ) {
335
291
self . pending_events . enqueue ( Event :: LSPS2Client (
336
292
LSPS2ClientEvent :: InvoiceParametersReady {
0 commit comments