From 91a60c82567d95e982adab4e19e8df5666b41904 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 9 Sep 2024 15:30:09 +0000 Subject: [PATCH] impl `Borrow<[u8]>` for `ChannelId` We do this for `Payment*` in `lightning-types` and its needed for the `hex_conservaitve` `impl_fmt_traits` macro which we'll use in the next commit. --- lightning/src/ln/channelmanager.rs | 2 +- lightning/src/ln/types.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index b3047930f..a1dc6fd4c 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -7135,7 +7135,7 @@ where chan } else { let update_actions = peer_state.monitor_update_blocked_actions - .remove(&channel_id).unwrap_or(Vec::new()); + .remove(channel_id).unwrap_or(Vec::new()); mem::drop(peer_state_lock); mem::drop(per_peer_state); self.handle_monitor_update_completion_actions(update_actions); diff --git a/lightning/src/ln/types.rs b/lightning/src/ln/types.rs index 659c7e4ca..9d56ad46d 100644 --- a/lightning/src/ln/types.rs +++ b/lightning/src/ln/types.rs @@ -30,6 +30,7 @@ use bitcoin::hashes::{ HashEngine as _, sha256::Hash as Sha256, }; +use core::borrow::Borrow; use core::fmt; use core::ops::Deref; @@ -127,6 +128,12 @@ impl fmt::Display for ChannelId { } } +impl Borrow<[u8]> for ChannelId { + fn borrow(&self) -> &[u8] { + &self.0[..] + } +} + pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; #[cfg(test)] -- 2.39.5