]> git.bitcoin.ninja Git - rust-lightning/commitdiff
impl `Borrow<[u8]>` for `ChannelId`
authorMatt Corallo <git@bluematt.me>
Mon, 9 Sep 2024 15:30:09 +0000 (15:30 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 9 Sep 2024 15:30:09 +0000 (15:30 +0000)
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
lightning/src/ln/types.rs

index b3047930f6146d5549d9535ec5fe9eb08e290522..a1dc6fd4cfcfd23ccc9ae4744fc7b055ebf58b77 100644 (file)
@@ -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);
index 659c7e4cabaf1938d119c344c0f212b1b87ba26b..9d56ad46d85b7e65f40ea9c14cd8d285cb16d539 100644 (file)
@@ -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)]