Skip to content

Commit 3e7ac44

Browse files
committed
simln-lib/refactor: remove unnecessary &mut references
1 parent 7133e13 commit 3e7ac44

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

simln-lib/src/cln.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl ClnNode {
112112
/// Fetch channels belonging to the local node, initiated locally if is_source is true, and initiated remotely if
113113
/// is_source is false. Introduced as a helper function because CLN doesn't have a single API to list all of our
114114
/// node's channels.
115-
async fn node_channels(&mut self, is_source: bool) -> Result<Vec<u64>, LightningError> {
115+
async fn node_channels(&self, is_source: bool) -> Result<Vec<u64>, LightningError> {
116116
let req = if is_source {
117117
ListchannelsRequest {
118118
source: Some(self.info.pubkey.serialize().to_vec()),
@@ -265,7 +265,7 @@ impl LightningNode for ClnNode {
265265
}
266266
}
267267

268-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError> {
268+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError> {
269269
let mut node_channels = self.node_channels(true).await?;
270270
node_channels.extend(self.node_channels(false).await?);
271271
Ok(node_channels)

simln-lib/src/eclair.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl LightningNode for EclairNode {
222222
})
223223
}
224224

225-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError> {
225+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError> {
226226
let client = self.client.lock().await;
227227
let channels: ChannelsResponse = client
228228
.request("channels", None)

simln-lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub trait LightningNode: Send {
341341
async fn get_node_info(&self, node_id: &PublicKey) -> Result<NodeInfo, LightningError>;
342342
/// Lists all channels, at present only returns a vector of channel capacities in msat because no further
343343
/// information is required.
344-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError>;
344+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError>;
345345
/// Get the network graph from the point of view of a given node.
346346
async fn get_graph(&self) -> Result<Graph, LightningError>;
347347
}

simln-lib/src/lnd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl LightningNode for LndNode {
260260
}
261261
}
262262

263-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError> {
263+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError> {
264264
let mut client = self.client.lock().await;
265265
let channels = client
266266
.lightning()

simln-lib/src/sim_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
709709
Ok(self.network.lock().await.lookup_node(node_id)?.0)
710710
}
711711

712-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError> {
712+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError> {
713713
Ok(self.network.lock().await.lookup_node(&self.info.pubkey)?.1)
714714
}
715715

@@ -1897,7 +1897,7 @@ mod tests {
18971897

18981898
// Create a simulated node for the first channel in our network.
18991899
let pk = channels[0].node_1.policy.pubkey;
1900-
let mut node = SimNode::new(
1900+
let node = SimNode::new(
19011901
node_info(pk, String::default()),
19021902
sim_network.clone(),
19031903
Arc::new(graph),

simln-lib/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mock! {
8888
shutdown: triggered::Listener,
8989
) -> Result<crate::PaymentResult, LightningError>;
9090
async fn get_node_info(&self, node_id: &PublicKey) -> Result<NodeInfo, LightningError>;
91-
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError>;
91+
async fn list_channels(&self) -> Result<Vec<u64>, LightningError>;
9292
async fn get_graph(&self) -> Result<Graph, LightningError>;
9393
}
9494
}

0 commit comments

Comments
 (0)