From b696effcd39d2945d280519232609aa868f63455 Mon Sep 17 00:00:00 2001 From: Blake Johnson Date: Fri, 6 Dec 2024 19:11:23 +0000 Subject: [PATCH] Using from_be_bytes to parse the feature bits instead of reversing the bytes before parsing --- simln-lib/src/cln.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/simln-lib/src/cln.rs b/simln-lib/src/cln.rs index bc9a6ef..700732b 100644 --- a/simln-lib/src/cln.rs +++ b/simln-lib/src/cln.rs @@ -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() }; @@ -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 {