X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Ffeatures.rs;h=d1f6b89db4f87e968e3624289331c00c476875fe;hb=4be201641d262deca678ded5772fdc51cfa86b3e;hp=e78fa3d50d2d05c5bfcafe1fd58eb1b654c167f7;hpb=69ee4860848d5992b238eca3343141004d9d1572;p=rust-lightning diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index e78fa3d5..d1f6b89d 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -25,6 +25,7 @@ use io; use prelude::*; use core::{cmp, fmt}; +use core::hash::{Hash, Hasher}; use core::marker::PhantomData; use bitcoin::bech32; @@ -362,6 +363,11 @@ impl Clone for Features { } } } +impl Hash for Features { + fn hash(&self, hasher: &mut H) { + self.flags.hash(hasher); + } +} impl PartialEq for Features { fn eq(&self, o: &Self) -> bool { self.flags.eq(&o.flags) @@ -548,7 +554,9 @@ impl Features { &self.flags } - pub(crate) fn requires_unknown_bits(&self) -> bool { + /// Returns true if this `Features` object contains unknown feature flags which are set as + /// "required". + pub fn requires_unknown_bits(&self) -> bool { // Bitwise AND-ing with all even bits set except for known features will select required // unknown features. let byte_count = T::KNOWN_FEATURE_MASK.len();