Skip to content

Commit d272759

Browse files
committed
Rename to “HTLCHandlingFailed”
PaymentForwardingFailed is somewhat of a misnomer. We change all instance of “payment_forwarding” with “htlc_handling”
1 parent 4a3f21a commit d272759

11 files changed

+103
-72
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out) {
854854
events::Event::PendingHTLCsForwardable { .. } => {
855855
nodes[$node].process_pending_htlc_forwards();
856856
},
857-
events::Event::PaymentForwardedFailed { .. } => {},
857+
events::Event::HTLCHandlingFailed { .. } => {},
858858
_ => if out.may_fail.load(atomic::Ordering::Acquire) {
859859
return;
860860
} else {

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
832832

833833
// Fail the payment backwards, failing the monitor update on nodes[1]'s receipt of the RAA
834834
nodes[2].node.fail_htlc_backwards(&payment_hash_1);
835-
expect_pending_htlcs_forwardable!(nodes[2], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
835+
expect_pending_htlcs_forwardable!(nodes[2], HTLCHandlingFailedConditions::new().htlc_processing_failed());
836836
check_added_monitors!(nodes[2], 1);
837837

838838
let updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
@@ -913,7 +913,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
913913
let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_2.2).unwrap().clone();
914914
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
915915
check_added_monitors!(nodes[1], 0);
916-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
916+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
917917
check_added_monitors!(nodes[1], 1);
918918

919919
let mut events_3 = nodes[1].node.get_and_clear_pending_msg_events();
@@ -1697,7 +1697,7 @@ fn test_monitor_update_on_pending_forwards() {
16971697

16981698
let (_, payment_hash_1, _) = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 1000000);
16991699
nodes[2].node.fail_htlc_backwards(&payment_hash_1);
1700-
expect_pending_htlcs_forwardable!(nodes[2], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
1700+
expect_pending_htlcs_forwardable!(nodes[2], HTLCHandlingFailedConditions::new().htlc_processing_failed());
17011701
check_added_monitors!(nodes[2], 1);
17021702

17031703
let cs_fail_update = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
@@ -1718,7 +1718,7 @@ fn test_monitor_update_on_pending_forwards() {
17181718
commitment_signed_dance!(nodes[1], nodes[2], payment_event.commitment_msg, false);
17191719

17201720
chanmon_cfgs[1].persister.set_update_ret(Err(ChannelMonitorUpdateErr::TemporaryFailure));
1721-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
1721+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
17221722
check_added_monitors!(nodes[1], 1);
17231723
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
17241724
nodes[1].logger.assert_log("lightning::ln::channelmanager".to_string(), "Failed to update ChannelMonitor".to_string(), 1);
@@ -2106,7 +2106,7 @@ fn test_fail_htlc_on_broadcast_after_claim() {
21062106
check_closed_broadcast!(nodes[1], true);
21072107
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
21082108
check_added_monitors!(nodes[1], 1);
2109-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
2109+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
21102110

21112111
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_updates.update_fulfill_htlcs[0]);
21122112
expect_payment_sent_without_paths!(nodes[0], payment_preimage);
@@ -2469,7 +2469,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
24692469
};
24702470
if second_fails {
24712471
nodes[2].node.fail_htlc_backwards(&payment_hash);
2472-
expect_pending_htlcs_forwardable!(nodes[2], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
2472+
expect_pending_htlcs_forwardable!(nodes[2], HTLCHandlingFailedConditions::new().htlc_processing_failed());
24732473
check_added_monitors!(nodes[2], 1);
24742474
get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
24752475
} else {
@@ -2505,7 +2505,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
25052505

25062506
if second_fails {
25072507
reconnect_nodes(&nodes[1], &nodes[2], (false, false), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0), (false, false));
2508-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
2508+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
25092509
} else {
25102510
reconnect_nodes(&nodes[1], &nodes[2], (false, false), (0, 0), (1, 0), (0, 0), (0, 0), (0, 0), (false, false));
25112511
}

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3841,7 +3841,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
38413841
});
38423842
}
38433843
let mut pending_events = self.pending_events.lock().unwrap();
3844-
pending_events.push(events::Event::PaymentForwardedFailed {
3844+
pending_events.push(events::Event::HTLCHandlingFailed {
38453845
source_channel_id: outpoint.to_channel_id(),
38463846
destination: receiver
38473847
});
@@ -7258,7 +7258,7 @@ mod tests {
72587258
check_added_monitors!(nodes[1], 0);
72597259
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
72607260
expect_pending_htlcs_forwardable!(nodes[1]);
7261-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
7261+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
72627262
check_added_monitors!(nodes[1], 1);
72637263
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
72647264
assert!(updates.update_add_htlcs.is_empty());
@@ -7381,7 +7381,7 @@ mod tests {
73817381
// We have to forward pending HTLCs twice - once tries to forward the payment forward (and
73827382
// fails), the second will process the resulting failure and fail the HTLC backward
73837383
expect_pending_htlcs_forwardable!(nodes[1]);
7384-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
7384+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
73857385
check_added_monitors!(nodes[1], 1);
73867386
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
73877387
assert!(updates.update_add_htlcs.is_empty());
@@ -7422,7 +7422,7 @@ mod tests {
74227422
check_added_monitors!(nodes[1], 0);
74237423
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
74247424
expect_pending_htlcs_forwardable!(nodes[1]);
7425-
expect_pending_htlcs_forwardable!(nodes[1], PaymentForwardedFailedConditions::new().payment_forwarding_failed());
7425+
expect_pending_htlcs_forwardable!(nodes[1], HTLCHandlingFailedConditions::new().htlc_processing_failed());
74267426
check_added_monitors!(nodes[1], 1);
74277427
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
74287428
assert!(updates.update_add_htlcs.is_empty());

lightning/src/ln/functional_test_utils.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ macro_rules! commitment_signed_dance {
11881188
{
11891189
commitment_signed_dance!($node_a, $node_b, $commitment_signed, $fail_backwards, true);
11901190
if $fail_backwards {
1191-
expect_pending_htlcs_forwardable!($node_a, PaymentForwardedFailedConditions::new().payment_forwarding_failed());
1191+
expect_pending_htlcs_forwardable!($node_a, HTLCHandlingFailedConditions::new().htlc_processing_failed());
11921192
check_added_monitors!($node_a, 1);
11931193

11941194
let channel_state = $node_a.node.channel_state.lock().unwrap();
@@ -1255,16 +1255,16 @@ macro_rules! get_route_and_payment_hash {
12551255
}}
12561256
}
12571257

1258-
pub struct PaymentForwardedFailedConditions {
1258+
pub struct HTLCHandlingFailedConditions {
12591259
pub expected_pending_htlcs_forwardable: bool,
1260-
pub expected_payment_forwarding_failed: Option<u32>,
1260+
pub expected_htlc_processing_failed: Option<u32>,
12611261
}
12621262

1263-
impl PaymentForwardedFailedConditions {
1263+
impl HTLCHandlingFailedConditions {
12641264
pub fn new() -> Self {
12651265
Self {
12661266
expected_pending_htlcs_forwardable: false,
1267-
expected_payment_forwarding_failed: None,
1267+
expected_htlc_processing_failed: None,
12681268
}
12691269
}
12701270

@@ -1273,13 +1273,13 @@ impl PaymentForwardedFailedConditions {
12731273
self
12741274
}
12751275

1276-
pub fn payment_forwarding_failed(mut self) -> Self {
1277-
self.expected_payment_forwarding_failed = Some(1);
1276+
pub fn htlc_processing_failed(mut self) -> Self {
1277+
self.expected_htlc_processing_failed = Some(1);
12781278
self
12791279
}
12801280

1281-
pub fn payment_forwarding_failed_with_count(mut self, count: u32) -> Self {
1282-
self.expected_payment_forwarding_failed = Some(count);
1281+
pub fn htlc_processing_failed_with_count(mut self, count: u32) -> Self {
1282+
self.expected_htlc_processing_failed = Some(count);
12831283
self
12841284
}
12851285
}
@@ -1293,7 +1293,7 @@ macro_rules! expect_pending_htlcs_forwardable_conditions {
12931293
_ => panic!("Unexpected event"),
12941294
};
12951295

1296-
if let Some(count) = $conditions.expected_payment_forwarding_failed {
1296+
if let Some(count) = $conditions.expected_htlc_processing_failed {
12971297
assert_eq!(events.len() as u32, count + 1u32);
12981298
} else {
12991299
assert_eq!(events.len(), 1);
@@ -1305,7 +1305,7 @@ macro_rules! expect_pending_htlcs_forwardable_conditions {
13051305
/// Clears (and ignores) a PendingHTLCsForwardable event
13061306
macro_rules! expect_pending_htlcs_forwardable_ignore {
13071307
($node: expr) => {{
1308-
expect_pending_htlcs_forwardable_conditions!($node, $crate::ln::functional_test_utils::PaymentForwardedFailedConditions::new());
1308+
expect_pending_htlcs_forwardable_conditions!($node, $crate::ln::functional_test_utils::HTLCHandlingFailedConditions::new());
13091309
}};
13101310

13111311
($node: expr, $conditions: expr) => {{
@@ -1850,7 +1850,7 @@ pub fn fail_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expe
18501850
assert_eq!(path.last().unwrap().node.get_our_node_id(), expected_paths[0].last().unwrap().node.get_our_node_id());
18511851
}
18521852
expected_paths[0].last().unwrap().node.fail_htlc_backwards(&our_payment_hash);
1853-
expect_pending_htlcs_forwardable!(expected_paths[0].last().unwrap(), PaymentForwardedFailedConditions::new().payment_forwarding_failed_with_count(expected_paths.len() as u32));
1853+
expect_pending_htlcs_forwardable!(expected_paths[0].last().unwrap(), HTLCHandlingFailedConditions::new().htlc_processing_failed_with_count(expected_paths.len() as u32));
18541854

18551855
pass_failed_payment_back(origin_node, expected_paths, skip_last, our_payment_hash);
18561856
}
@@ -1891,7 +1891,7 @@ pub fn pass_failed_payment_back<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expe
18911891
node.node.handle_update_fail_htlc(&prev_node.node.get_our_node_id(), &next_msgs.as_ref().unwrap().0);
18921892
commitment_signed_dance!(node, prev_node, next_msgs.as_ref().unwrap().1, update_next_node);
18931893
if !update_next_node {
1894-
expect_pending_htlcs_forwardable!(node, PaymentForwardedFailedConditions::new().payment_forwarding_failed());
1894+
expect_pending_htlcs_forwardable!(node, HTLCHandlingFailedConditions::new().htlc_processing_failed());
18951895
}
18961896
}
18971897
let events = node.node.get_and_clear_pending_msg_events();

0 commit comments

Comments
 (0)