Skip to content

Commit c1a0b35

Browse files
committed
f Drop expect_pending_htlcs_forwardable_.._ignore macro
1 parent b38c19e commit c1a0b35

File tree

6 files changed

+44
-49
lines changed

6 files changed

+44
-49
lines changed

lightning/src/ln/blinded_payment_tests.rs

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

744744
if intercept_node_fails {
745745
nodes[1].node.fail_intercepted_htlc(intercept_id).unwrap();
746-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[1], vec![HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid }]);
746+
expect_pending_htlcs_forwardable_conditions(nodes[1].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid }]);
747747
nodes[1].node.process_pending_htlc_forwards();
748748
check_added_monitors!(&nodes[1], 1);
749749
fail_blinded_htlc_backwards(payment_hash, 1, &[&nodes[0], &nodes[1]], false);
@@ -1042,8 +1042,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
10421042
do_commitment_signed_dance(&nodes[2], &nodes[1], &payment_event_1_2.commitment_msg, true, true);
10431043
nodes[2].node.process_pending_htlc_forwards();
10441044
nodes[2].node.process_pending_htlc_forwards();
1045-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[2],
1046-
vec![HTLCHandlingFailureType::Receive { payment_hash }]);
1045+
expect_pending_htlcs_forwardable_conditions(nodes[2].node.get_and_clear_pending_events(), &[HTLCHandlingFailureType::Receive { payment_hash }]);
10471046
check_added_monitors!(nodes[2], 1);
10481047
},
10491048
ReceiveCheckFail::PaymentConstraints => {

lightning/src/ln/functional_test_utils.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,16 +2007,6 @@ macro_rules! expect_pending_htlcs_forwardable_ignore {
20072007
}
20082008
}
20092009

2010-
#[macro_export]
2011-
/// Clears (and ignores) PendingHTLCsForwardable and HTLCHandlingFailed events
2012-
///
2013-
/// Don't use this, call [`expect_pending_htlcs_forwardable_conditions()`] instead.
2014-
macro_rules! expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore {
2015-
($node: expr, $expected_failures: expr) => {
2016-
$crate::ln::functional_test_utils::expect_pending_htlcs_forwardable_conditions($node.node.get_and_clear_pending_events(), &$expected_failures);
2017-
}
2018-
}
2019-
20202010
#[macro_export]
20212011
/// Handles a PendingHTLCsForwardable and HTLCHandlingFailed event
20222012
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
@@ -7224,9 +7224,9 @@ pub fn test_bump_txn_sanitize_tracking_maps() {
72247224

72257225
// Broadcast set of revoked txn on A
72267226
connect_blocks(&nodes[0], TEST_FINAL_CLTV + 2 - CHAN_CONFIRM_DEPTH);
7227-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
7228-
nodes[0],
7229-
vec![HTLCHandlingFailureType::Receive { payment_hash: payment_hash_2 }]
7227+
expect_pending_htlcs_forwardable_conditions(
7228+
nodes[0].node.get_and_clear_pending_events(),
7229+
&[HTLCHandlingFailureType::Receive { payment_hash: payment_hash_2 }],
72307230
);
72317231
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 0);
72327232

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

9519-
let expected_destinations = vec![
9519+
let expected_destinations = &[
95209520
HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash },
95219521
HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash },
95229522
];
9523-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
9524-
nodes[1],
9525-
expected_destinations
9523+
expect_pending_htlcs_forwardable_conditions(
9524+
nodes[1].node.get_and_clear_pending_events(),
9525+
expected_destinations,
95269526
);
95279527
nodes[1].node.process_pending_htlc_forwards();
95289528

@@ -9554,9 +9554,9 @@ fn do_test_dup_htlc_second_rejected(test_for_second_fail_panic: bool) {
95549554
}
95559555
} else {
95569556
// Let the second HTLC fail and claim the first
9557-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
9558-
nodes[1],
9559-
vec![HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash }]
9557+
expect_pending_htlcs_forwardable_conditions(
9558+
nodes[1].node.get_and_clear_pending_events(),
9559+
&[HTLCHandlingFailureType::Receive { payment_hash: our_payment_hash }],
95609560
);
95619561
nodes[1].node.process_pending_htlc_forwards();
95629562

@@ -9687,7 +9687,10 @@ pub fn test_inconsistent_mpp_params() {
96879687
expect_pending_htlcs_forwardable_ignore!(nodes[3]);
96889688
nodes[3].node.process_pending_htlc_forwards();
96899689
let fail_type = HTLCHandlingFailureType::Receive { payment_hash: hash };
9690-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[3], [fail_type]);
9690+
expect_pending_htlcs_forwardable_conditions(
9691+
nodes[3].node.get_and_clear_pending_events(),
9692+
&[fail_type],
9693+
);
96919694
nodes[3].node.process_pending_htlc_forwards();
96929695

96939696
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
@@ -1738,8 +1738,8 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
17381738
// `COUNTERPARTY_CLAIMABLE_WITHIN_BLOCKS_PINNABLE` blocks, making us consider all the HTLCs
17391739
// pinnable claims, which the remainder of the test assumes.
17401740
connect_blocks(&nodes[0], TEST_FINAL_CLTV - COUNTERPARTY_CLAIMABLE_WITHIN_BLOCKS_PINNABLE);
1741-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(&nodes[0],
1742-
[HTLCHandlingFailureType::Receive { payment_hash: failed_payment_hash }]);
1741+
expect_pending_htlcs_forwardable_conditions(nodes[0].node.get_and_clear_pending_events(),
1742+
&[HTLCHandlingFailureType::Receive { payment_hash: failed_payment_hash }]);
17431743
// A will generate justice tx from B's revoked commitment/HTLC tx
17441744
mine_transaction(&nodes[0], &revoked_local_txn[0]);
17451745
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
@@ -2463,9 +2463,9 @@ fn test_phantom_onion_hmac_failure() {
24632463
}
24642464
};
24652465
nodes[1].node.process_pending_htlc_forwards();
2466-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2467-
nodes[1],
2468-
vec![HTLCHandlingFailureType::Receive { payment_hash }]
2466+
expect_pending_htlcs_forwardable_conditions(
2467+
nodes[1].node.get_and_clear_pending_events(),
2468+
&[HTLCHandlingFailureType::Receive { payment_hash }],
24692469
);
24702470
nodes[1].node.process_pending_htlc_forwards();
24712471
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2564,9 +2564,9 @@ fn test_phantom_invalid_onion_payload() {
25642564
}
25652565
}
25662566
nodes[1].node.process_pending_htlc_forwards();
2567-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2568-
nodes[1],
2569-
vec![HTLCHandlingFailureType::Receive { payment_hash }]
2567+
expect_pending_htlcs_forwardable_conditions(
2568+
nodes[1].node.get_and_clear_pending_events(),
2569+
&[HTLCHandlingFailureType::Receive { payment_hash }],
25702570
);
25712571
nodes[1].node.process_pending_htlc_forwards();
25722572
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2630,9 +2630,9 @@ fn test_phantom_final_incorrect_cltv_expiry() {
26302630
}
26312631
}
26322632
nodes[1].node.process_pending_htlc_forwards();
2633-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2634-
nodes[1],
2635-
vec![HTLCHandlingFailureType::Receive { payment_hash }]
2633+
expect_pending_htlcs_forwardable_conditions(
2634+
nodes[1].node.get_and_clear_pending_events(),
2635+
&[HTLCHandlingFailureType::Receive { payment_hash }],
26362636
);
26372637
nodes[1].node.process_pending_htlc_forwards();
26382638
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2684,9 +2684,9 @@ fn test_phantom_failure_too_low_cltv() {
26842684

26852685
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
26862686
nodes[1].node.process_pending_htlc_forwards();
2687-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2688-
nodes[1],
2689-
vec![HTLCHandlingFailureType::Receive { payment_hash }]
2687+
expect_pending_htlcs_forwardable_conditions(
2688+
nodes[1].node.get_and_clear_pending_events(),
2689+
&[HTLCHandlingFailureType::Receive { payment_hash }],
26902690
);
26912691
nodes[1].node.process_pending_htlc_forwards();
26922692
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2844,9 +2844,9 @@ fn test_phantom_failure_too_low_recv_amt() {
28442844
nodes[1].node.process_pending_htlc_forwards();
28452845
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
28462846
nodes[1].node.process_pending_htlc_forwards();
2847-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2848-
nodes[1],
2849-
vec![HTLCHandlingFailureType::Receive { payment_hash: payment_hash.clone() }]
2847+
expect_pending_htlcs_forwardable_conditions(
2848+
nodes[1].node.get_and_clear_pending_events(),
2849+
&[HTLCHandlingFailureType::Receive { payment_hash: payment_hash.clone() }],
28502850
);
28512851
nodes[1].node.process_pending_htlc_forwards();
28522852
let update_1 = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
@@ -2973,9 +2973,9 @@ fn test_phantom_failure_reject_payment() {
29732973
route.paths[0].hops.last().unwrap().pubkey
29742974
);
29752975
nodes[1].node.fail_htlc_backwards(&payment_hash);
2976-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2977-
nodes[1],
2978-
vec![HTLCHandlingFailureType::Receive { payment_hash }]
2976+
expect_pending_htlcs_forwardable_conditions(
2977+
nodes[1].node.get_and_clear_pending_events(),
2978+
&[HTLCHandlingFailureType::Receive { payment_hash }],
29792979
);
29802980
nodes[1].node.process_pending_htlc_forwards();
29812981

lightning/src/ln/payment_tests.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,10 @@ fn do_test_intercepted_payment(test: InterceptTest) {
21882188
nodes[1].node.fail_intercepted_htlc(intercept_id).unwrap();
21892189
let fail =
21902190
HTLCHandlingFailureType::InvalidForward { requested_forward_scid: intercept_scid };
2191-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[1], [fail]);
2191+
expect_pending_htlcs_forwardable_conditions(
2192+
nodes[1].node.get_and_clear_pending_events(),
2193+
&[fail],
2194+
);
21922195
nodes[1].node.process_pending_htlc_forwards();
21932196
let update_fail = get_htlc_update_msgs!(nodes[1], node_a_id);
21942197
check_added_monitors!(&nodes[1], 1);
@@ -2533,12 +2536,12 @@ fn do_automatic_retries(test: AutoRetry) {
25332536
commitment_signed_dance!(nodes[1], nodes[0], &update_0.commitment_signed, false, true);
25342537
expect_pending_htlcs_forwardable_ignore!(nodes[1]);
25352538
nodes[1].node.process_pending_htlc_forwards();
2536-
expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(
2537-
nodes[1],
2538-
[HTLCHandlingFailureType::Forward {
2539+
expect_pending_htlcs_forwardable_conditions(
2540+
nodes[1].node.get_and_clear_pending_events(),
2541+
&[HTLCHandlingFailureType::Forward {
25392542
node_id: Some(node_c_id),
25402543
channel_id: $failing_channel_id,
2541-
}]
2544+
}],
25422545
);
25432546
nodes[1].node.process_pending_htlc_forwards();
25442547
let update_1 = get_htlc_update_msgs!(nodes[1], node_a_id);

0 commit comments

Comments
 (0)