X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Fmsgs.rs;h=0e6c4b95ee32645d4e43a5ead08331e99d4784f6;hb=ab8f5a8620760eaac3d5a150d06e35ac88ae1ea1;hp=a27b896701412918886d3c890074f03fdfe5f64a;hpb=38098ba657b1aaf5551f882bc900dafbc027617c;p=rust-lightning diff --git a/src/ln/msgs.rs b/src/ln/msgs.rs index a27b8967..0e6c4b95 100644 --- a/src/ln/msgs.rs +++ b/src/ln/msgs.rs @@ -63,23 +63,19 @@ impl LocalFeatures { #[cfg(not(feature = "fuzztarget"))] pub(crate) fn new() -> LocalFeatures { LocalFeatures { - flags: vec![1 << 4], + flags: vec![2 | 1 << 5], } } #[cfg(feature = "fuzztarget")] pub fn new() -> LocalFeatures { LocalFeatures { - flags: vec![1 << 4], + flags: vec![2 | 1 << 5], } } pub(crate) fn supports_data_loss_protect(&self) -> bool { self.flags.len() > 0 && (self.flags[0] & 3) != 0 } - pub(crate) fn requires_data_loss_protect(&self) -> bool { - self.flags.len() > 0 && (self.flags[0] & 1) != 0 - } - pub(crate) fn initial_routing_sync(&self) -> bool { self.flags.len() > 0 && (self.flags[0] & (1 << 3)) != 0 } @@ -94,8 +90,9 @@ impl LocalFeatures { pub(crate) fn supports_upfront_shutdown_script(&self) -> bool { self.flags.len() > 0 && (self.flags[0] & (3 << 4)) != 0 } + #[cfg(test)] pub(crate) fn unset_upfront_shutdown_script(&mut self) { - self.flags[0] ^= 1 << 4; + self.flags[0] ^= 1 << 5; } pub(crate) fn requires_unknown_bits(&self) -> bool { @@ -2017,9 +2014,9 @@ mod tests { target_value.append(&mut hex::decode("0000").unwrap()); } if initial_routing_sync { - target_value.append(&mut hex::decode("000118").unwrap()); + target_value.append(&mut hex::decode("00012a").unwrap()); } else { - target_value.append(&mut hex::decode("000110").unwrap()); + target_value.append(&mut hex::decode("000122").unwrap()); } assert_eq!(encoded_value, target_value); }