Skip to content

Commit 3a1907a

Browse files
committed
f Drop expect_pending_htlcs_forwardable_.._ignore macro
1 parent 418af58 commit 3a1907a

File tree

6 files changed

+44
-52
lines changed

6 files changed

+44
-52
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ fn do_blinded_intercept_payment(intercept_node_fails: bool) {
742742

743743
if intercept_node_fails {
744744
nodes[1].node.fail_intercepted_htlc(intercept_id).unwrap();
745-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[1], [HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid }]);
745+
expect_pending_htlcs_forwardable_conditions(nodes[1].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid }]);
746746
nodes[1].node.process_pending_htlc_forwards();
747747
check_added_monitors!(&nodes[1], 1);
748748
fail_blinded_htlc_backwards(payment_hash, 1, &[&nodes[0], &nodes[1]], false);
@@ -1040,8 +1040,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
10401040
check_added_monitors!(nodes[2], 0);
10411041
do_commitment_signed_dance(&nodes[2], &nodes[1], &payment_event_1_2.commitment_msg, true, true);
10421042
expect_pending_htlc_processing(&nodes[2], true);
1043-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[2],
1044-
[HTLCHandlingFailureType::Receive { payment_hash }]);
1043+
expect_pending_htlcs_forwardable_conditions(nodes[2].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::Receive { payment_hash }]);
10451044
check_added_monitors!(nodes[2], 1);
10461045
},
10471046
ReceiveCheckFail::PaymentConstraints => {

lightning/src/ln/functional_test_utils.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,19 +2399,6 @@ macro_rules! expect_pending_htlcs_forwardable_ignore {
23992399
};
24002400
}
24012401

2402-
#[macro_export]
2403-
/// Clears (and ignores) PendingHTLCsForwardable and HTLCHandlingFailed events
2404-
///
2405-
/// Don't use this, call [`expect_pending_htlcs_forwardable_conditions()`] instead.
2406-
macro_rules! expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore {
2407-
($node: expr, $expected_failures: expr) => {
2408-
$crate::ln::functional_test_utils::expect_pending_htlcs_forwardable_conditions(
2409-
$node.node.get_and_clear_pending_events(),
2410-
&$expected_failures,
2411-
);
2412-
};
2413-
}
2414-
24152402
#[macro_export]
24162403
/// Handles a PendingHTLCsForwardable and HTLCHandlingFailed event
24172404
macro_rules! expect_pending_htlcs_forwardable_and_htlc_handling_failed {

lightning/src/ln/functional_tests.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7209,9 +7209,9 @@ pub fn test_bump_txn_sanitize_tracking_maps() {
72097209

72107210
// Broadcast set of revoked txn on A
72117211
connect_blocks(&nodes[0], TEST_FINAL_CLTV + 2 - CHAN_CONFIRM_DEPTH);
7212-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
7213-
nodes[0],
7214-
[HTLCHandlingFailureType::Receive { payment_hash: payment_hash_2 }]
7212+
expect_pending_htlcs_forwardable_conditions(
7213+
nodes[0].node.get_and_clear_pending_events(),
7214+
&[HTLCHandlingFailureType::Receive { payment_hash: payment_hash_2 }],
72157215
);
72167216
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 0);
72177217

@@ -9504,13 +9504,13 @@ fn do_test_dup_htlc_second_rejected(test_for_second_fail_panic: bool) {
95049504
// Now we go fail back the first HTLC from the user end.
95059505
nodes[1].node.fail_htlc_backwards(&our_payment_hash);
95069506

9507-
let expected_destinations = vec![
9507+
let expected_destinations = &[
95089508
HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash },
95099509
HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash },
95109510
];
9511-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
9512-
nodes[1],
9513-
expected_destinations
9511+
expect_pending_htlcs_forwardable_conditions(
9512+
nodes[1].node.get_and_clear_pending_events(),
9513+
expected_destinations,
95149514
);
95159515
nodes[1].node.process_pending_htlc_forwards();
95169516

@@ -9542,9 +9542,9 @@ fn do_test_dup_htlc_second_rejected(test_for_second_fail_panic: bool) {
95429542
}
95439543
} else {
95449544
// Let the second HTLC fail and claim the first
9545-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
9546-
nodes[1],
9547-
[HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash }]
9545+
expect_pending_htlcs_forwardable_conditions(
9546+
nodes[1].node.get_and_clear_pending_events(),
9547+
&[HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash }],
95489548
);
95499549
nodes[1].node.process_pending_htlc_forwards();
95509550

@@ -9675,7 +9675,10 @@ pub fn test_inconsistent_mpp_params() {
96759675
expect_pending_htlcs_forwardable_ignore!(nodes[3]);
96769676
nodes[3].node.process_pending_htlc_forwards();
96779677
let fail_type = HTLCHandlingFailureType::Receive { payment_hash: hash };
9678-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[3], [fail_type]);
9678+
expect_pending_htlcs_forwardable_conditions(
9679+
nodes[3].node.get_and_clear_pending_events(),
9680+
&[fail_type],
9681+
);
96799682
nodes[3].node.process_pending_htlc_forwards();
96809683

96819684
check_added_monitors(&nodes[3], 1);

lightning/src/ln/monitor_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,8 +1683,8 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
16831683
// `COUNTERPARTY_CLAIMABLE_WITHIN_BLOCKS_PINNABLE` blocks, making us consider all the HTLCs
16841684
// pinnable claims, which the remainder of the test assumes.
16851685
connect_blocks(&nodes[0], TEST_FINAL_CLTV - COUNTERPARTY_CLAIMABLE_WITHIN_BLOCKS_PINNABLE);
1686-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(&nodes[0],
1687-
[HTLCHandlingFailureType::Receive { payment_hash: failed_payment_hash }]);
1686+
expect_pending_htlcs_forwardable_conditions(nodes[0].node.get_and_clear_pending_events(),
1687+
&[HTLCHandlingFailureType::Receive { payment_hash: failed_payment_hash }]);
16881688
// A will generate justice tx from B's revoked commitment/HTLC tx
16891689
mine_transaction(&nodes[0], &revoked_local_txn[0]);
16901690
check_closed_broadcast!(nodes[0], true);

lightning/src/ln/onion_route_tests.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,9 +2461,9 @@ fn test_phantom_onion_hmac_failure() {
24612461
}
24622462
};
24632463
nodes[1].node.process_pending_htlc_forwards();
2464-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2465-
nodes[1],
2466-
[HTLCHandlingFailureType::Receive { payment_hash }]
2464+
expect_pending_htlcs_forwardable_conditions(
2465+
nodes[1].node.get_and_clear_pending_events(),
2466+
&[HTLCHandlingFailureType::Receive { payment_hash }],
24672467
);
24682468
nodes[1].node.process_pending_htlc_forwards();
24692469
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2562,9 +2562,9 @@ fn test_phantom_invalid_onion_payload() {
25622562
}
25632563
}
25642564
nodes[1].node.process_pending_htlc_forwards();
2565-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2566-
nodes[1],
2567-
[HTLCHandlingFailureType::Receive { payment_hash }]
2565+
expect_pending_htlcs_forwardable_conditions(
2566+
nodes[1].node.get_and_clear_pending_events(),
2567+
&[HTLCHandlingFailureType::Receive { payment_hash }],
25682568
);
25692569
nodes[1].node.process_pending_htlc_forwards();
25702570
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2628,9 +2628,9 @@ fn test_phantom_final_incorrect_cltv_expiry() {
26282628
}
26292629
}
26302630
nodes[1].node.process_pending_htlc_forwards();
2631-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2632-
nodes[1],
2633-
[HTLCHandlingFailureType::Receive { payment_hash }]
2631+
expect_pending_htlcs_forwardable_conditions(
2632+
nodes[1].node.get_and_clear_pending_events(),
2633+
&[HTLCHandlingFailureType::Receive { payment_hash }],
26342634
);
26352635
nodes[1].node.process_pending_htlc_forwards();
26362636
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2682,9 +2682,9 @@ fn test_phantom_failure_too_low_cltv() {
26822682

26832683
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
26842684
nodes[1].node.process_pending_htlc_forwards();
2685-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2686-
nodes[1],
2687-
[HTLCHandlingFailureType::Receive { payment_hash }]
2685+
expect_pending_htlcs_forwardable_conditions(
2686+
nodes[1].node.get_and_clear_pending_events(),
2687+
&[HTLCHandlingFailureType::Receive { payment_hash }],
26882688
);
26892689
nodes[1].node.process_pending_htlc_forwards();
26902690
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2842,9 +2842,9 @@ fn test_phantom_failure_too_low_recv_amt() {
28422842
nodes[1].node.process_pending_htlc_forwards();
28432843
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
28442844
nodes[1].node.process_pending_htlc_forwards();
2845-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2846-
nodes[1],
2847-
[HTLCHandlingFailureType::Receive { payment_hash: payment_hash.clone() }]
2845+
expect_pending_htlcs_forwardable_conditions(
2846+
nodes[1].node.get_and_clear_pending_events(),
2847+
&[HTLCHandlingFailureType::Receive { payment_hash: payment_hash.clone() }],
28482848
);
28492849
nodes[1].node.process_pending_htlc_forwards();
28502850
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2971,9 +2971,9 @@ fn test_phantom_failure_reject_payment() {
29712971
route.paths[0].hops.last().unwrap().pubkey
29722972
);
29732973
nodes[1].node.fail_htlc_backwards(&payment_hash);
2974-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2975-
nodes[1],
2976-
[HTLCHandlingFailureType::Receive { payment_hash }]
2974+
expect_pending_htlcs_forwardable_conditions(
2975+
nodes[1].node.get_and_clear_pending_events(),
2976+
&[HTLCHandlingFailureType::Receive { payment_hash }],
29772977
);
29782978
nodes[1].node.process_pending_htlc_forwards();
29792979

lightning/src/ln/payment_tests.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,10 @@ fn do_test_intercepted_payment(test: InterceptTest) {
21902190
nodes[1].node.fail_intercepted_htlc(intercept_id).unwrap();
21912191
let fail =
21922192
HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid };
2193-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[1], [fail]);
2193+
expect_pending_htlcs_forwardable_conditions(
2194+
nodes[1].node.get_and_clear_pending_events(),
2195+
&[fail],
2196+
);
21942197
nodes[1].node.process_pending_htlc_forwards();
21952198
let update_fail = get_htlc_update_msgs!(nodes[1], node_a_id);
21962199
check_added_monitors!(&nodes[1], 1);
@@ -2535,12 +2538,12 @@ fn do_automatic_retries(test: AutoRetry) {
25352538
commitment_signed_dance!(nodes[1], nodes[0], &update_0.commitment_signed, false, true);
25362539
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
25372540
nodes[1].node.process_pending_htlc_forwards();
2538-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2539-
nodes[1],
2540-
[HTLCHandlingFailureType::Forward {
2541+
expect_pending_htlcs_forwardable_conditions(
2542+
nodes[1].node.get_and_clear_pending_events(),
2543+
&[HTLCHandlingFailureType::Forward {
25412544
node_id: Some(node_c_id),
25422545
channel_id: $failing_channel_id,
2543-
}]
2546+
}],
25442547
);
25452548
nodes[1].node.process_pending_htlc_forwards();
25462549
let update_1 = get_htlc_update_msgs!(nodes[1], node_a_id);

0 commit comments

Comments
 (0)