File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ use alloc::vec::Vec;
1515use bitcoin:: secp256k1:: PublicKey ;
1616
1717use lightning:: impl_writeable_tlv_based_enum;
18- use lightning:: util:: hash_tables:: HashMap ;
1918
2019use super :: msgs:: LSPS5AppName ;
2120use super :: msgs:: LSPS5Error ;
@@ -70,7 +69,7 @@ pub enum LSPS5ServiceEvent {
7069 /// - `"x-lsps5-timestamp"`: with the timestamp in RFC3339 format (`"YYYY-MM-DDThh:mm:ss.uuuZ"`).
7170 /// - `"x-lsps5-signature"`: with the signature of the notification payload, signed using the LSP's node ID.
7271 /// Other custom headers may also be included as needed.
73- headers : HashMap < String , String > ,
72+ headers : Vec < ( String , String ) > ,
7473 } ,
7574}
7675
Original file line number Diff line number Diff line change @@ -629,12 +629,12 @@ where
629629
630630 let signature_hex = self . sign_notification ( & notification, & timestamp) ?;
631631
632- let mut headers: HashMap < String , String > = [ ( "Content-Type" , "application/json" ) ]
632+ let mut headers: Vec < ( String , String ) > = [ ( "Content-Type" , "application/json" ) ]
633633 . into_iter ( )
634634 . map ( |( k, v) | ( k. to_string ( ) , v. to_string ( ) ) )
635635 . collect ( ) ;
636- headers. insert ( "x-lsps5-timestamp" . into ( ) , timestamp. to_rfc3339 ( ) ) ;
637- headers. insert ( "x-lsps5-signature" . into ( ) , signature_hex) ;
636+ headers. push ( ( "x-lsps5-timestamp" . into ( ) , timestamp. to_rfc3339 ( ) ) ) ;
637+ headers. push ( ( "x-lsps5-signature" . into ( ) , signature_hex) ) ;
638638
639639 event_queue_notifier. enqueue ( LSPS5ServiceEvent :: SendWebhookNotification {
640640 counterparty_node_id,
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ use lightning::ln::functional_test_utils::{
1717} ;
1818use lightning:: ln:: msgs:: Init ;
1919use lightning:: ln:: peer_handler:: CustomMessageHandler ;
20- use lightning:: util:: hash_tables:: { HashMap , HashSet } ;
20+ use lightning:: util:: hash_tables:: HashSet ;
2121use lightning:: util:: test_utils:: TestStore ;
2222use lightning_liquidity:: events:: LiquidityEvent ;
2323use lightning_liquidity:: lsps0:: ser:: LSPSDateTime ;
@@ -288,15 +288,20 @@ impl TimeProvider for MockTimeProvider {
288288 }
289289}
290290
291- fn extract_ts_sig ( headers : & HashMap < String , String > ) -> ( LSPSDateTime , String ) {
291+ fn extract_ts_sig ( headers : & Vec < ( String , String ) > ) -> ( LSPSDateTime , String ) {
292292 let timestamp = headers
293- . get ( "x-lsps5-timestamp" )
293+ . iter ( )
294+ . find_map ( |( key, value) | ( key == "x-lsps5-timestamp" ) . then ( || value) )
294295 . expect ( "missing x-lsps5-timestamp header" )
295296 . parse :: < LSPSDateTime > ( )
296297 . expect ( "failed to parse x-lsps5-timestamp header" ) ;
297298
298- let signature =
299- headers. get ( "x-lsps5-signature" ) . expect ( "missing x-lsps5-signature header" ) . to_owned ( ) ;
299+ let signature = headers
300+ . iter ( )
301+ . find ( |( key, _) | key == "x-lsps5-signature" )
302+ . expect ( "missing x-lsps5-signature header" )
303+ . 1
304+ . clone ( ) ;
300305 ( timestamp, signature)
301306}
302307
You can’t perform that action at this time.
0 commit comments