@@ -5,13 +5,13 @@ use core::convert::TryFrom;
55use  bitcoin:: hashes:: hmac:: { Hmac ,  HmacEngine } ; 
66use  bitcoin:: hashes:: sha256:: Hash  as  Sha256 ; 
77use  bitcoin:: hashes:: { Hash ,  HashEngine } ; 
8- use  chrono:: Utc ; 
98use  serde:: { Deserialize ,  Serialize } ; 
109
1110use  lightning:: util:: scid_utils; 
1211
1312use  crate :: lsps0:: ser:: { 
14- 	string_amount,  string_amount_option,  LSPSMessage ,  LSPSRequestId ,  LSPSResponseError , 
13+ 	string_amount,  string_amount_option,  LSPSDateTime ,  LSPSMessage ,  LSPSRequestId , 
14+ 	LSPSResponseError , 
1515} ; 
1616use  crate :: prelude:: { String ,  Vec } ; 
1717use  crate :: utils; 
@@ -42,7 +42,7 @@ pub struct LSPS2RawOpeningFeeParams {
4242	/// A fee proportional to the size of the initial payment. 
4343 	pub  proportional :  u32 , 
4444	/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. 
45-  	pub  valid_until :  chrono :: DateTime < Utc > , 
45+  	pub  valid_until :  LSPSDateTime , 
4646	/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. 
4747 	pub  min_lifetime :  u32 , 
4848	/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. 
@@ -93,7 +93,7 @@ pub struct LSPS2OpeningFeeParams {
9393	/// A fee proportional to the size of the initial payment. 
9494 	pub  proportional :  u32 , 
9595	/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. 
96-  	pub  valid_until :  chrono :: DateTime < Utc > , 
96+  	pub  valid_until :  LSPSDateTime , 
9797	/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. 
9898 	pub  min_lifetime :  u32 , 
9999	/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. 
@@ -214,15 +214,17 @@ impl From<LSPS2Message> for LSPSMessage {
214214#[ cfg( test) ]  
215215mod  tests { 
216216	use  super :: * ; 
217+ 
217218	use  crate :: alloc:: string:: ToString ; 
218219	use  crate :: lsps2:: utils:: is_valid_opening_fee_params; 
219220
221+ 	use  core:: str:: FromStr ; 
222+ 
220223	#[ test]  
221224	fn  into_opening_fee_params_produces_valid_promise ( )  { 
222225		let  min_fee_msat = 100 ; 
223226		let  proportional = 21 ; 
224- 		let  valid_until:  chrono:: DateTime < Utc >  =
225- 			chrono:: DateTime :: parse_from_rfc3339 ( "2035-05-20T08:30:45Z" ) . unwrap ( ) . into ( ) ; 
227+ 		let  valid_until = LSPSDateTime :: from_str ( "2035-05-20T08:30:45Z" ) . unwrap ( ) ; 
226228		let  min_lifetime = 144 ; 
227229		let  max_client_to_self_delay = 128 ; 
228230		let  min_payment_size_msat = 1 ; 
@@ -257,7 +259,7 @@ mod tests {
257259	fn  changing_single_field_produced_invalid_params ( )  { 
258260		let  min_fee_msat = 100 ; 
259261		let  proportional = 21 ; 
260- 		let  valid_until = chrono :: DateTime :: parse_from_rfc3339 ( "2035-05-20T08:30:45Z" ) . unwrap ( ) ; 
262+ 		let  valid_until = LSPSDateTime :: from_str ( "2035-05-20T08:30:45Z" ) . unwrap ( ) ; 
261263		let  min_lifetime = 144 ; 
262264		let  max_client_to_self_delay = 128 ; 
263265		let  min_payment_size_msat = 1 ; 
@@ -266,7 +268,7 @@ mod tests {
266268		let  raw = LSPS2RawOpeningFeeParams  { 
267269			min_fee_msat, 
268270			proportional, 
269- 			valid_until :  valid_until . into ( ) , 
271+ 			valid_until, 
270272			min_lifetime, 
271273			max_client_to_self_delay, 
272274			min_payment_size_msat, 
@@ -284,7 +286,7 @@ mod tests {
284286	fn  wrong_secret_produced_invalid_params ( )  { 
285287		let  min_fee_msat = 100 ; 
286288		let  proportional = 21 ; 
287- 		let  valid_until = chrono :: DateTime :: parse_from_rfc3339 ( "2035-05-20T08:30:45Z" ) . unwrap ( ) ; 
289+ 		let  valid_until = LSPSDateTime :: from_str ( "2035-05-20T08:30:45Z" ) . unwrap ( ) ; 
288290		let  min_lifetime = 144 ; 
289291		let  max_client_to_self_delay = 128 ; 
290292		let  min_payment_size_msat = 1 ; 
@@ -293,7 +295,7 @@ mod tests {
293295		let  raw = LSPS2RawOpeningFeeParams  { 
294296			min_fee_msat, 
295297			proportional, 
296- 			valid_until :  valid_until . into ( ) , 
298+ 			valid_until, 
297299			min_lifetime, 
298300			max_client_to_self_delay, 
299301			min_payment_size_msat, 
@@ -313,7 +315,7 @@ mod tests {
313315	fn  expired_params_produces_invalid_params ( )  { 
314316		let  min_fee_msat = 100 ; 
315317		let  proportional = 21 ; 
316- 		let  valid_until = chrono :: DateTime :: parse_from_rfc3339 ( "2023-05-20T08:30:45Z" ) . unwrap ( ) ; 
318+ 		let  valid_until = LSPSDateTime :: from_str ( "2023-05-20T08:30:45Z" ) . unwrap ( ) ; 
317319		let  min_lifetime = 144 ; 
318320		let  max_client_to_self_delay = 128 ; 
319321		let  min_payment_size_msat = 1 ; 
@@ -322,7 +324,7 @@ mod tests {
322324		let  raw = LSPS2RawOpeningFeeParams  { 
323325			min_fee_msat, 
324326			proportional, 
325- 			valid_until :  valid_until . into ( ) , 
327+ 			valid_until, 
326328			min_lifetime, 
327329			max_client_to_self_delay, 
328330			min_payment_size_msat, 
@@ -339,7 +341,7 @@ mod tests {
339341	fn  buy_request_serialization ( )  { 
340342		let  min_fee_msat = 100 ; 
341343		let  proportional = 21 ; 
342- 		let  valid_until = chrono :: DateTime :: parse_from_rfc3339 ( "2023-05-20T08:30:45Z" ) . unwrap ( ) ; 
344+ 		let  valid_until = LSPSDateTime :: from_str ( "2023-05-20T08:30:45Z" ) . unwrap ( ) ; 
343345		let  min_lifetime = 144 ; 
344346		let  max_client_to_self_delay = 128 ; 
345347		let  min_payment_size_msat = 1 ; 
@@ -348,7 +350,7 @@ mod tests {
348350		let  raw = LSPS2RawOpeningFeeParams  { 
349351			min_fee_msat, 
350352			proportional, 
351- 			valid_until :  valid_until . into ( ) , 
353+ 			valid_until, 
352354			min_lifetime, 
353355			max_client_to_self_delay, 
354356			min_payment_size_msat, 
0 commit comments