From: Matt Corallo Date: Mon, 9 Sep 2024 15:30:09 +0000 (+0000) Subject: impl `Borrow<[u8]>` for `ChannelId` X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=91a60c82567d95e982adab4e19e8df5666b41904;p=rust-lightning 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. --- 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)]