Skip to content

Commit 3b865f6

Browse files
committed
fixup! sim-ln/style: Fix Formatting Issues
1 parent 6c66492 commit 3b865f6

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

simln-lib/src/eclair.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ impl LightningNode for EclairNode {
247247

248248
async fn get_graph(&mut self) -> Result<Graph, LightningError> {
249249
let nodes: NodesResponse = self
250-
.client
251-
.request("nodes", None)
252-
.await
253-
.map_err(|err| LightningError::GetNodeInfoError(err.to_string()))?;
250+
.client
251+
.request("nodes", None)
252+
.await
253+
.map_err(|err| LightningError::GetNodeInfoError(err.to_string()))?;
254254

255255
let mut nodes_by_pk: HashMap<PublicKey, NodeInfo> = HashMap::new();
256256
let mut nodes_by_alias: HashMap<String, Vec<NodeInfo>> = HashMap::new();
@@ -262,7 +262,7 @@ impl LightningNode for EclairNode {
262262
NodeInfo {
263263
pubkey: PublicKey::from_str(&node.node_id).expect("Public Key not valid"),
264264
alias: node.alias.clone(),
265-
features: parse_json_to_node_features(&node.features),
265+
features: parse_json_to_node_features(&node.features),
266266
},
267267
);
268268
if nodes_by_alias.contains_key(&node.alias) {
@@ -271,7 +271,7 @@ impl LightningNode for EclairNode {
271271
updated_alias_nodes.extend(vec![NodeInfo {
272272
pubkey: PublicKey::from_str(&node.node_id).expect("Public Key not valid"),
273273
alias: node.alias.clone(),
274-
features: parse_json_to_node_features(&node.features),
274+
features: parse_json_to_node_features(&node.features),
275275
}]);
276276
nodes_by_alias.insert(node.alias.clone(), updated_alias_nodes);
277277
}
@@ -281,7 +281,7 @@ impl LightningNode for EclairNode {
281281
vec![NodeInfo {
282282
pubkey: PublicKey::from_str(&node.node_id).expect("Public Key not valid"),
283283
alias: node.alias,
284-
features: parse_json_to_node_features(&node.features),
284+
features: parse_json_to_node_features(&node.features),
285285
}],
286286
);
287287
}

simln-lib/src/sim_node.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use bitcoin::secp256k1::PublicKey;
77
use bitcoin::{Network, ScriptBuf, TxOut};
88
use lightning::ln::chan_utils::make_funding_redeemscript;
99
use std::collections::{hash_map::Entry, HashMap};
10+
use std::str::FromStr;
1011
use std::sync::Arc;
1112
use std::time::{SystemTime, UNIX_EPOCH};
1213
use tokio_util::task::TaskTracker;
@@ -646,16 +647,17 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
646647

647648
async fn get_graph(&mut self) -> Result<Graph, LightningError> {
648649
let nodes = self.network.lock().await.fetch_nodes().await?;
649-
650-
let nodes_by_pk = HashMap::new();
650+
651+
let mut nodes_by_pk = HashMap::new();
651652
let nodes_by_alias = HashMap::new();
652653
let channels = HashMap::new();
653654

654655
for node in nodes {
655656
nodes_by_pk.insert(
656-
PublicKey::from_str(&node.pubkey).expect("Public Key not valid"),
657+
PublicKey::from_str(&node.pubkey.to_string()).expect("Public Key not valid"),
657658
NodeInfo {
658-
pubkey: PublicKey::from_str(&node.pubkey).expect("Public Key not valid"),
659+
pubkey: PublicKey::from_str(&node.pubkey.to_string())
660+
.expect("Public Key not valid"),
659661
alias: node.alias.clone(),
660662
features: node.features,
661663
},
@@ -872,9 +874,9 @@ impl SimNetwork for SimGraph {
872874
for node in &self.nodes {
873875
nodes.push(node_info(*node.0));
874876
}
875-
876-
Ok(nodes)
877-
}
877+
878+
Ok(nodes)
879+
}
878880
}
879881

880882
/// Adds htlcs to the simulation state along the path provided. Returning the index in the path from which to fail

0 commit comments

Comments
 (0)