diff --git a/lightning-liquidity/src/lsps5/event.rs b/lightning-liquidity/src/lsps5/event.rs index a9c1052250a..c12273808ef 100644 --- a/lightning-liquidity/src/lsps5/event.rs +++ b/lightning-liquidity/src/lsps5/event.rs @@ -15,7 +15,6 @@ use alloc::vec::Vec; use bitcoin::secp256k1::PublicKey; use lightning::impl_writeable_tlv_based_enum; -use lightning::util::hash_tables::HashMap; use super::msgs::LSPS5AppName; use super::msgs::LSPS5Error; @@ -70,7 +69,7 @@ pub enum LSPS5ServiceEvent { /// - `"x-lsps5-timestamp"`: with the timestamp in RFC3339 format (`"YYYY-MM-DDThh:mm:ss.uuuZ"`). /// - `"x-lsps5-signature"`: with the signature of the notification payload, signed using the LSP's node ID. /// Other custom headers may also be included as needed. - headers: HashMap, + headers: Vec<(String, String)>, }, } diff --git a/lightning-liquidity/src/lsps5/msgs.rs b/lightning-liquidity/src/lsps5/msgs.rs index 341dfcddf00..e457c299bfe 100644 --- a/lightning-liquidity/src/lsps5/msgs.rs +++ b/lightning-liquidity/src/lsps5/msgs.rs @@ -541,34 +541,29 @@ pub struct WebhookNotification { } impl WebhookNotification { - /// Create a new webhook notification. - pub fn new(method: WebhookNotificationMethod) -> Self { - Self { method } - } - /// Create a webhook_registered notification. pub fn webhook_registered() -> Self { - Self::new(WebhookNotificationMethod::LSPS5WebhookRegistered) + Self { method: WebhookNotificationMethod::LSPS5WebhookRegistered } } /// Create a payment_incoming notification. pub fn payment_incoming() -> Self { - Self::new(WebhookNotificationMethod::LSPS5PaymentIncoming) + Self { method: WebhookNotificationMethod::LSPS5PaymentIncoming } } /// Create an expiry_soon notification. pub fn expiry_soon(timeout: u32) -> Self { - Self::new(WebhookNotificationMethod::LSPS5ExpirySoon { timeout }) + Self { method: WebhookNotificationMethod::LSPS5ExpirySoon { timeout } } } /// Create a liquidity_management_request notification. pub fn liquidity_management_request() -> Self { - Self::new(WebhookNotificationMethod::LSPS5LiquidityManagementRequest) + Self { method: WebhookNotificationMethod::LSPS5LiquidityManagementRequest } } /// Create an onion_message_incoming notification. pub fn onion_message_incoming() -> Self { - Self::new(WebhookNotificationMethod::LSPS5OnionMessageIncoming) + Self { method: WebhookNotificationMethod::LSPS5OnionMessageIncoming } } } diff --git a/lightning-liquidity/src/lsps5/service.rs b/lightning-liquidity/src/lsps5/service.rs index f7f5e06a2c5..0b5a901288d 100644 --- a/lightning-liquidity/src/lsps5/service.rs +++ b/lightning-liquidity/src/lsps5/service.rs @@ -629,12 +629,12 @@ where let signature_hex = self.sign_notification(¬ification, ×tamp)?; - let mut headers: HashMap = [("Content-Type", "application/json")] + let mut headers: Vec<(String, String)> = [("Content-Type", "application/json")] .into_iter() .map(|(k, v)| (k.to_string(), v.to_string())) .collect(); - headers.insert("x-lsps5-timestamp".into(), timestamp.to_rfc3339()); - headers.insert("x-lsps5-signature".into(), signature_hex); + headers.push(("x-lsps5-timestamp".into(), timestamp.to_rfc3339())); + headers.push(("x-lsps5-signature".into(), signature_hex)); event_queue_notifier.enqueue(LSPS5ServiceEvent::SendWebhookNotification { counterparty_node_id, diff --git a/lightning-liquidity/tests/lsps5_integration_tests.rs b/lightning-liquidity/tests/lsps5_integration_tests.rs index 41af2e85eed..80707a60774 100644 --- a/lightning-liquidity/tests/lsps5_integration_tests.rs +++ b/lightning-liquidity/tests/lsps5_integration_tests.rs @@ -17,7 +17,7 @@ use lightning::ln::functional_test_utils::{ }; use lightning::ln::msgs::Init; use lightning::ln::peer_handler::CustomMessageHandler; -use lightning::util::hash_tables::{HashMap, HashSet}; +use lightning::util::hash_tables::HashSet; use lightning::util::test_utils::TestStore; use lightning_liquidity::events::LiquidityEvent; use lightning_liquidity::lsps0::ser::LSPSDateTime; @@ -288,15 +288,20 @@ impl TimeProvider for MockTimeProvider { } } -fn extract_ts_sig(headers: &HashMap) -> (LSPSDateTime, String) { +fn extract_ts_sig(headers: &Vec<(String, String)>) -> (LSPSDateTime, String) { let timestamp = headers - .get("x-lsps5-timestamp") + .iter() + .find_map(|(key, value)| (key == "x-lsps5-timestamp").then(|| value)) .expect("missing x-lsps5-timestamp header") .parse::() .expect("failed to parse x-lsps5-timestamp header"); - let signature = - headers.get("x-lsps5-signature").expect("missing x-lsps5-signature header").to_owned(); + let signature = headers + .iter() + .find(|(key, _)| key == "x-lsps5-signature") + .expect("missing x-lsps5-signature header") + .1 + .clone(); (timestamp, signature) } diff --git a/lightning/src/util/anchor_channel_reserves.rs b/lightning/src/util/anchor_channel_reserves.rs index ebae770fb8a..e50e103211f 100644 --- a/lightning/src/util/anchor_channel_reserves.rs +++ b/lightning/src/util/anchor_channel_reserves.rs @@ -290,8 +290,8 @@ pub fn can_support_additional_anchor_channel< >, >, >( - context: &AnchorChannelReserveContext, utxos: &[Utxo], a_channel_manager: &AChannelManagerRef, - chain_monitor: &ChainMonitorRef, + context: &AnchorChannelReserveContext, utxos: &[Utxo], a_channel_manager: AChannelManagerRef, + chain_monitor: ChainMonitorRef, ) -> bool where AChannelManagerRef::Target: AChannelManager,