X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Fmsgs.rs;h=f6968c5d3a32dfd4b0b20915ee5db02839943efb;hb=c05e087c430e05934a5312342f886f9d19889b20;hp=10e83e08ddeec17b114a3aea31b7bf8dfabe9332;hpb=0052b2c5c3017aec1a80b6476fad441b63a67a8c;p=rust-lightning diff --git a/src/ln/msgs.rs b/src/ln/msgs.rs index 10e83e08..f6968c5d 100644 --- a/src/ln/msgs.rs +++ b/src/ln/msgs.rs @@ -60,9 +60,16 @@ pub struct LocalFeatures { impl LocalFeatures { /// Create a blank LocalFeatures flags (visibility extended for fuzz tests) + #[cfg(not(feature = "fuzztarget"))] + pub(crate) fn new() -> LocalFeatures { + LocalFeatures { + flags: vec![1 << 5], + } + } + #[cfg(feature = "fuzztarget")] pub fn new() -> LocalFeatures { LocalFeatures { - flags: Vec::new(), + flags: vec![1 << 5], } } @@ -87,8 +94,9 @@ impl LocalFeatures { pub(crate) fn supports_upfront_shutdown_script(&self) -> bool { self.flags.len() > 0 && (self.flags[0] & (3 << 4)) != 0 } - pub(crate) fn requires_upfront_shutdown_script(&self) -> bool { - self.flags.len() > 0 && (self.flags[0] & (1 << 4)) != 0 + #[cfg(test)] + pub(crate) fn unset_upfront_shutdown_script(&mut self) { + self.flags[0] ^= 1 << 5; } pub(crate) fn requires_unknown_bits(&self) -> bool { @@ -706,7 +714,6 @@ mod fuzzy_internal_msgs { pub(crate) data: OnionRealm0HopData, pub(crate) hmac: [u8; 32], } - unsafe impl ::util::internal_traits::NoDealloc for OnionHopData{} pub struct DecodedOnionErrorPacket { pub(crate) hmac: [u8; 32], @@ -2011,9 +2018,9 @@ mod tests { target_value.append(&mut hex::decode("0000").unwrap()); } if initial_routing_sync { - target_value.append(&mut hex::decode("000108").unwrap()); + target_value.append(&mut hex::decode("000128").unwrap()); } else { - target_value.append(&mut hex::decode("0000").unwrap()); + target_value.append(&mut hex::decode("000120").unwrap()); } assert_eq!(encoded_value, target_value); }