Skip to content

Commit 8cdb255

Browse files
committed
Removed unused extracted vars
1 parent 011ea05 commit 8cdb255

File tree

3 files changed

+15
-48
lines changed

3 files changed

+15
-48
lines changed

lightning/src/ln/async_signer_tests.rs

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ fn do_test_async_commitment_signature_for_commitment_signed_revoke_and_ack(
289289
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
290290
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
291291
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
292-
let node_a_id = nodes[0].node.get_our_node_id();
293-
let node_b_id = nodes[1].node.get_our_node_id();
294292
let (_, _, chan_id, _) = create_announced_chan_between_nodes(&nodes, 0, 1);
295293

296294
// Send a payment.
@@ -533,8 +531,6 @@ fn do_test_async_raa_peer_disconnect(
533531
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
534532
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
535533
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
536-
let node_a_id = nodes[0].node.get_our_node_id();
537-
let node_b_id = nodes[1].node.get_our_node_id();
538534
let (_, _, chan_id, _) = create_announced_chan_between_nodes(&nodes, 0, 1);
539535

540536
// Send a payment.
@@ -699,8 +695,6 @@ fn do_test_async_commitment_signature_peer_disconnect(
699695
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
700696
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
701697
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
702-
let node_a_id = nodes[0].node.get_our_node_id();
703-
let node_b_id = nodes[1].node.get_our_node_id();
704698
let (_, _, chan_id, _) = create_announced_chan_between_nodes(&nodes, 0, 1);
705699

706700
// Send a payment.
@@ -1422,13 +1416,10 @@ fn test_no_disconnect_while_async_revoke_and_ack_expecting_remote_commitment_sig
14221416
let node_b_id = nodes[1].node.get_our_node_id();
14231417
let chan_id = create_announced_chan_between_nodes(&nodes, 0, 1).2;
14241418

1425-
let node_id_0 = node_a_id;
1426-
let node_id_1 = node_b_id;
1427-
14281419
let payment_amount = 1_000_000;
14291420
send_payment(&nodes[0], &[&nodes[1]], payment_amount * 4);
14301421

1431-
nodes[1].disable_channel_signer_op(&node_id_0, &chan_id, SignerOp::ReleaseCommitmentSecret);
1422+
nodes[1].disable_channel_signer_op(&node_a_id, &chan_id, SignerOp::ReleaseCommitmentSecret);
14321423

14331424
// We'll send a payment from both nodes to each other.
14341425
let (route1, payment_hash1, _, payment_secret1) =
@@ -1445,20 +1436,20 @@ fn test_no_disconnect_while_async_revoke_and_ack_expecting_remote_commitment_sig
14451436
nodes[1].node.send_payment_with_route(route2, payment_hash2, onion2, payment_id2).unwrap();
14461437
check_added_monitors(&nodes[1], 1);
14471438

1448-
let update = get_htlc_update_msgs!(&nodes[0], node_id_1);
1449-
nodes[1].node.handle_update_add_htlc(node_id_0, &update.update_add_htlcs[0]);
1450-
nodes[1].node.handle_commitment_signed_batch_test(node_id_0, &update.commitment_signed);
1439+
let update = get_htlc_update_msgs!(&nodes[0], node_b_id);
1440+
nodes[1].node.handle_update_add_htlc(node_a_id, &update.update_add_htlcs[0]);
1441+
nodes[1].node.handle_commitment_signed_batch_test(node_a_id, &update.commitment_signed);
14511442
check_added_monitors(&nodes[1], 1);
14521443

1453-
let update = get_htlc_update_msgs!(&nodes[1], node_id_0);
1454-
nodes[0].node.handle_update_add_htlc(node_id_1, &update.update_add_htlcs[0]);
1455-
nodes[0].node.handle_commitment_signed_batch_test(node_id_1, &update.commitment_signed);
1444+
let update = get_htlc_update_msgs!(&nodes[1], node_a_id);
1445+
nodes[0].node.handle_update_add_htlc(node_b_id, &update.update_add_htlcs[0]);
1446+
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &update.commitment_signed);
14561447
check_added_monitors(&nodes[0], 1);
14571448

14581449
// nodes[0] can only respond with a `revoke_and_ack`. The `commitment_signed` that would follow
14591450
// is blocked on receiving a counterparty `revoke_and_ack`, which nodes[1] is still pending on.
1460-
let revoke_and_ack = get_event_msg!(&nodes[0], MessageSendEvent::SendRevokeAndACK, node_id_1);
1461-
nodes[1].node.handle_revoke_and_ack(node_id_0, &revoke_and_ack);
1451+
let revoke_and_ack = get_event_msg!(&nodes[0], MessageSendEvent::SendRevokeAndACK, node_b_id);
1452+
nodes[1].node.handle_revoke_and_ack(node_a_id, &revoke_and_ack);
14621453
check_added_monitors(&nodes[1], 1);
14631454

14641455
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
@@ -1495,27 +1486,24 @@ fn test_no_disconnect_while_async_commitment_signed_expecting_remote_revoke_and_
14951486
let node_b_id = nodes[1].node.get_our_node_id();
14961487
let chan_id = create_announced_chan_between_nodes(&nodes, 0, 1).2;
14971488

1498-
let node_id_0 = node_a_id;
1499-
let node_id_1 = node_b_id;
1500-
15011489
// Route a payment and attempt to claim it.
15021490
let payment_amount = 1_000_000;
15031491
let (preimage, payment_hash, ..) = route_payment(&nodes[0], &[&nodes[1]], payment_amount);
15041492
nodes[1].node.claim_funds(preimage);
15051493
check_added_monitors(&nodes[1], 1);
15061494

15071495
// We'll disable signing counterparty commitments on the payment sender.
1508-
nodes[0].disable_channel_signer_op(&node_id_1, &chan_id, SignerOp::SignCounterpartyCommitment);
1496+
nodes[0].disable_channel_signer_op(&node_b_id, &chan_id, SignerOp::SignCounterpartyCommitment);
15091497

15101498
// After processing the `update_fulfill`, they'll only be able to send `revoke_and_ack` until
15111499
// the `commitment_signed` is no longer pending.
1512-
let update = get_htlc_update_msgs!(&nodes[1], node_id_0);
1513-
nodes[0].node.handle_update_fulfill_htlc(node_id_1, &update.update_fulfill_htlcs[0]);
1514-
nodes[0].node.handle_commitment_signed_batch_test(node_id_1, &update.commitment_signed);
1500+
let update = get_htlc_update_msgs!(&nodes[1], node_a_id);
1501+
nodes[0].node.handle_update_fulfill_htlc(node_b_id, &update.update_fulfill_htlcs[0]);
1502+
nodes[0].node.handle_commitment_signed_batch_test(node_b_id, &update.commitment_signed);
15151503
check_added_monitors(&nodes[0], 1);
15161504

1517-
let revoke_and_ack = get_event_msg!(&nodes[0], MessageSendEvent::SendRevokeAndACK, node_id_1);
1518-
nodes[1].node.handle_revoke_and_ack(node_id_0, &revoke_and_ack);
1505+
let revoke_and_ack = get_event_msg!(&nodes[0], MessageSendEvent::SendRevokeAndACK, node_b_id);
1506+
nodes[1].node.handle_revoke_and_ack(node_a_id, &revoke_and_ack);
15191507
check_added_monitors(&nodes[1], 1);
15201508

15211509
// The payment sender shouldn't disconnect the counterparty due to a missing `revoke_and_ack`

lightning/src/ln/priv_short_conf_tests.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ fn test_routed_scid_alias() {
351351
no_announce_cfg.accept_forwards_to_priv_channels = true;
352352
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, Some(no_announce_cfg), None]);
353353
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
354-
let node_a_id = nodes[0].node.get_our_node_id();
355354
let node_b_id = nodes[1].node.get_our_node_id();
356355
let node_c_id = nodes[2].node.get_our_node_id();
357356

@@ -853,8 +852,6 @@ fn test_simple_0conf_channel() {
853852

854853
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(chan_config)]);
855854
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
856-
let node_a_id = nodes[0].node.get_our_node_id();
857-
let node_b_id = nodes[1].node.get_our_node_id();
858855

859856
open_zero_conf_channel(&nodes[0], &nodes[1], None);
860857

@@ -876,7 +873,6 @@ fn test_0conf_channel_with_async_monitor() {
876873
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
877874
let node_a_id = nodes[0].node.get_our_node_id();
878875
let node_b_id = nodes[1].node.get_our_node_id();
879-
let node_c_id = nodes[2].node.get_our_node_id();
880876

881877
create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0);
882878

@@ -1080,7 +1076,6 @@ fn test_0conf_close_no_early_chan_update() {
10801076

10811077
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(chan_config.clone())]);
10821078
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
1083-
let node_a_id = nodes[0].node.get_our_node_id();
10841079
let node_b_id = nodes[1].node.get_our_node_id();
10851080
let error_message = "Channel force-closed";
10861081

lightning/src/ln/shutdown_tests.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ fn shutdown_on_unfunded_channel() {
343343
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
344344
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
345345
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
346-
let node_a_id = nodes[0].node.get_our_node_id();
347346
let node_b_id = nodes[1].node.get_our_node_id();
348347

349348
nodes[0].node.create_channel(node_b_id, 1_000_000, 100_000, 0, None, None).unwrap();
@@ -375,7 +374,6 @@ fn close_on_unfunded_channel() {
375374
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
376375
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
377376
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
378-
let node_a_id = nodes[0].node.get_our_node_id();
379377
let node_b_id = nodes[1].node.get_our_node_id();
380378

381379
let chan_id =
@@ -1243,7 +1241,6 @@ fn test_segwit_v0_shutdown_script() {
12431241
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
12441242
let node_a_id = nodes[0].node.get_our_node_id();
12451243
let node_b_id = nodes[1].node.get_our_node_id();
1246-
let node_c_id = nodes[2].node.get_our_node_id();
12471244

12481245
let chan = create_announced_chan_between_nodes(&nodes, 0, 1);
12491246
nodes[1].node.close_channel(&chan.2, &node_a_id).unwrap();
@@ -1283,7 +1280,6 @@ fn test_anysegwit_shutdown_script() {
12831280
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
12841281
let node_a_id = nodes[0].node.get_our_node_id();
12851282
let node_b_id = nodes[1].node.get_our_node_id();
1286-
let node_c_id = nodes[2].node.get_our_node_id();
12871283

12881284
let chan = create_announced_chan_between_nodes(&nodes, 0, 1);
12891285
nodes[1].node.close_channel(&chan.2, &node_a_id).unwrap();
@@ -1327,7 +1323,6 @@ fn test_unsupported_anysegwit_shutdown_script() {
13271323
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
13281324
let node_a_id = nodes[0].node.get_our_node_id();
13291325
let node_b_id = nodes[1].node.get_our_node_id();
1330-
let node_c_id = nodes[2].node.get_our_node_id();
13311326

13321327
// Check that using an unsupported shutdown script fails and a supported one succeeds.
13331328
let supported_shutdown_script =
@@ -1375,7 +1370,6 @@ fn test_invalid_shutdown_script() {
13751370
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
13761371
let node_a_id = nodes[0].node.get_our_node_id();
13771372
let node_b_id = nodes[1].node.get_our_node_id();
1378-
let node_c_id = nodes[2].node.get_our_node_id();
13791373

13801374
let chan = create_announced_chan_between_nodes(&nodes, 0, 1);
13811375
nodes[1].node.close_channel(&chan.2, &node_a_id).unwrap();
@@ -1404,8 +1398,6 @@ fn test_user_shutdown_script() {
14041398
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &user_cfgs);
14051399
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
14061400
let node_a_id = nodes[0].node.get_our_node_id();
1407-
let node_b_id = nodes[1].node.get_our_node_id();
1408-
let node_c_id = nodes[2].node.get_our_node_id();
14091401

14101402
// Segwit v0 script of the form OP_0 <20-byte hash>
14111403
let script = Builder::new().push_int(0).push_slice(&[0; 20]).into_script();
@@ -1435,8 +1427,6 @@ fn test_already_set_user_shutdown_script() {
14351427
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &user_cfgs);
14361428
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
14371429
let node_a_id = nodes[0].node.get_our_node_id();
1438-
let node_b_id = nodes[1].node.get_our_node_id();
1439-
let node_c_id = nodes[2].node.get_our_node_id();
14401430

14411431
// Segwit v0 script of the form OP_0 <20-byte hash>
14421432
let script = Builder::new().push_int(0).push_slice(&[0; 20]).into_script();
@@ -1878,10 +1868,6 @@ fn batch_funding_failure() {
18781868
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
18791869
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
18801870
let nodes = create_network(4, &node_cfgs, &node_chanmgrs);
1881-
let node_a_id = nodes[0].node.get_our_node_id();
1882-
let node_b_id = nodes[1].node.get_our_node_id();
1883-
let node_c_id = nodes[2].node.get_our_node_id();
1884-
let node_d_id = nodes[3].node.get_our_node_id();
18851871

18861872
let temp_chan_id_a = exchange_open_accept_chan(&nodes[0], &nodes[1], 1_000_000, 0);
18871873
let temp_chan_id_b = exchange_open_accept_chan(&nodes[0], &nodes[2], 1_000_000, 0);
@@ -2004,8 +1990,6 @@ fn test_force_closure_on_low_stale_fee() {
20041990
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
20051991
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
20061992
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
2007-
let node_a_id = nodes[0].node.get_our_node_id();
2008-
let node_b_id = nodes[1].node.get_our_node_id();
20091993

20101994
let chan_id = create_announced_chan_between_nodes(&nodes, 0, 1).2;
20111995

0 commit comments

Comments
 (0)