mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Merge pull request #308 from dongcarl/2019-02-reformulate-unknown-bits-calculation
msgs: Reformulate unknown bits calculation w/ any
This commit is contained in:
commit
591362fdb1
1 changed files with 6 additions and 16 deletions
|
@ -91,25 +91,15 @@ impl LocalFeatures {
|
|||
}
|
||||
|
||||
pub(crate) fn requires_unknown_bits(&self) -> bool {
|
||||
for (idx, &byte) in self.flags.iter().enumerate() {
|
||||
if idx != 0 && (byte & 0x55) != 0 {
|
||||
return true;
|
||||
} else if idx == 0 && (byte & 0x14) != 0 {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
self.flags.iter().enumerate().any(|(idx, &byte)| {
|
||||
( idx != 0 && (byte & 0x55) != 0 ) || ( idx == 0 && (byte & 0x14) != 0 )
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn supports_unknown_bits(&self) -> bool {
|
||||
for (idx, &byte) in self.flags.iter().enumerate() {
|
||||
if idx != 0 && byte != 0 {
|
||||
return true;
|
||||
} else if idx == 0 && (byte & 0xc4) != 0 {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
self.flags.iter().enumerate().any(|(idx, &byte)| {
|
||||
( idx != 0 && byte != 0 ) || ( idx == 0 && (byte & 0xc4) != 0 )
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue