Skip to content

Commit 31d0b85

Browse files
committed
Make LSPS5ServiceEvent::SendWebhookNotification::headers a Vec
While HTTP headers should be a unique K->V mapping, returning three headers to a user in an event via a `HashMap` is substantially overkill (and also not trivial to do in bindings). Instead, we expose them as a `Vec`.
1 parent 3293bef commit 31d0b85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lightning-liquidity/src/lsps5/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub enum LSPS5ServiceEvent {
7070
/// - `"x-lsps5-timestamp"`: with the timestamp in RFC3339 format (`"YYYY-MM-DDThh:mm:ss.uuuZ"`).
7171
/// - `"x-lsps5-signature"`: with the signature of the notification payload, signed using the LSP's node ID.
7272
/// Other custom headers may also be included as needed.
73-
headers: HashMap<String, String>,
73+
headers: Vec<(String, String)>,
7474
},
7575
}
7676

lightning-liquidity/src/lsps5/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)