Skip to content

Commit

Permalink
Using from_be_bytes to parse the feature bits instead of reversing th…
Browse files Browse the repository at this point in the history
…e bytes before parsing
  • Loading branch information
bjohnson5 committed Dec 6, 2024
1 parent 6396faf commit b696eff
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions simln-lib/src/cln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ impl ClnNode {
.map_err(|err| LightningError::GetInfoError(err.to_string()))?;
connection.id.validate(&pubkey, &mut alias)?;

let features = if let Some(mut features) = our_features {
features.node.reverse();
NodeFeatures::from_le_bytes(features.node)
let features = if let Some(features) = our_features {
NodeFeatures::from_be_bytes(features.node)
} else {
NodeFeatures::empty()
};
Expand Down Expand Up @@ -249,10 +248,8 @@ impl LightningNode for ClnNode {
features: node
.features
.clone()
.map_or(NodeFeatures::empty(), |mut f| {
// We need to reverse this given it has the CLN wire encoding which is BE
f.reverse();
NodeFeatures::from_le_bytes(f)
.map_or(NodeFeatures::empty(), |f| {
NodeFeatures::from_be_bytes(f)
}),
})
} else {
Expand Down

0 comments on commit b696eff

Please sign in to comment.