Skip to content

Commit

Permalink
remove unneeded mut in testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jan 27, 2025
1 parent 10b3678 commit 2b3bfc5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/fiber/tests/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5070,7 +5070,7 @@ async fn test_send_payment_with_channel_balance_error() {
let amounts = vec![(100000000000, 100000000000); nodes_num - 1];
let (nodes, channels) =
create_n_nodes_with_established_channel(&amounts, nodes_num, true).await;
let [node_0, _node_1, mut node_2, node_3] = nodes.try_into().expect("4 nodes");
let [node_0, _node_1, node_2, node_3] = nodes.try_into().expect("4 nodes");
let source_node = &node_0;
let target_pubkey = node_3.pubkey.clone();

Expand Down Expand Up @@ -5758,7 +5758,7 @@ async fn test_send_payment_will_succeed_with_retry_in_middle_hops() {
true,
)
.await;
let [mut node_0, _node_1, mut node_2, node_3] = nodes.try_into().expect("4 nodes");
let [mut node_0, _node_1, node_2, node_3] = nodes.try_into().expect("4 nodes");
let source_node = &mut node_0;
let node_0_amount = source_node.get_local_balance_from_channel(channels[0]);
let target_pubkey = node_3.pubkey.clone();
Expand Down
6 changes: 3 additions & 3 deletions src/fiber/tests/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ async fn test_send_payment_middle_hop_update_fee_send_payment_failed() {
true,
)
.await;
let [node_0, _node_1, mut node_2, node_3] = nodes.try_into().expect("4 nodes");
let [node_0, _node_1, node_2, node_3] = nodes.try_into().expect("4 nodes");

// node_2 update fee rate to a higher one, so the payment will fail
let res = node_0
Expand Down Expand Up @@ -1947,7 +1947,7 @@ async fn test_send_payment_middle_hop_update_fee_multiple_payments() {
// https://github.com/nervosnetwork/fiber/issues/480
init_tracing();
let _span = tracing::info_span!("node", node = "test").entered();
let (mut nodes, channels) = create_n_nodes_with_index_and_amounts_with_established_channel(
let (nodes, channels) = create_n_nodes_with_index_and_amounts_with_established_channel(
&[
((0, 1), (HUGE_CKB_AMOUNT, HUGE_CKB_AMOUNT)),
((1, 2), (HUGE_CKB_AMOUNT, HUGE_CKB_AMOUNT)),
Expand Down Expand Up @@ -2015,7 +2015,7 @@ async fn test_send_payment_middle_hop_update_fee_should_recovery() {
// in the end, all the payments should success
init_tracing();
let _span = tracing::info_span!("node", node = "test").entered();
let (mut nodes, channels) = create_n_nodes_with_index_and_amounts_with_established_channel(
let (nodes, channels) = create_n_nodes_with_index_and_amounts_with_established_channel(
&[
((0, 1), (HUGE_CKB_AMOUNT, HUGE_CKB_AMOUNT)),
((1, 2), (HUGE_CKB_AMOUNT, HUGE_CKB_AMOUNT)),
Expand Down
14 changes: 5 additions & 9 deletions src/fiber/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ impl NetworkNode {
}

pub async fn update_channel_actor_state(
&mut self,
&self,
state: ChannelActorState,
reload_params: Option<ReloadParams>,
) {
Expand All @@ -728,7 +728,7 @@ impl NetworkNode {
}

pub async fn update_channel_local_balance(
&mut self,
&self,
channel_id: Hash256,
new_to_local_amount: u128,
) {
Expand All @@ -739,7 +739,7 @@ impl NetworkNode {
}

pub async fn update_channel_remote_balance(
&mut self,
&self,
channel_id: Hash256,
new_to_remote_amount: u128,
) {
Expand All @@ -756,7 +756,7 @@ impl NetworkNode {
.await;
}

pub async fn disable_channel_stealthy(&mut self, channel_id: Hash256) {
pub async fn disable_channel_stealthy(&self, channel_id: Hash256) {
let mut channel_actor_state = self.get_channel_actor_state(channel_id);
channel_actor_state.local_tlc_info.enabled = false;
self.update_channel_actor_state(
Expand All @@ -768,11 +768,7 @@ impl NetworkNode {
.await;
}

pub async fn update_channel_with_command(
&mut self,
channel_id: Hash256,
command: UpdateCommand,
) {
pub async fn update_channel_with_command(&self, channel_id: Hash256, command: UpdateCommand) {
let message = |rpc_reply| -> NetworkActorMessage {
NetworkActorMessage::Command(NetworkActorCommand::ControlFiberChannel(
ChannelCommandWithId {
Expand Down

0 comments on commit 2b3bfc5

Please sign in to comment.