match event {
Event::PaymentPathFailed {
- payment_id, payment_hash, rejected_by_dest, path, short_channel_id, retry, ..
+ payment_id, payment_hash, payment_failed_permanently, path, short_channel_id, retry, ..
} => {
if let Some(short_channel_id) = short_channel_id {
let path = path.iter().collect::<Vec<_>>();
if payment_id.is_none() {
log_trace!(self.logger, "Payment {} has no id; not retrying", log_bytes!(payment_hash.0));
- } else if *rejected_by_dest {
+ } else if *payment_failed_permanently {
log_trace!(self.logger, "Payment {} rejected by destination; not retrying", log_bytes!(payment_hash.0));
self.payer.abandon_payment(payment_id.unwrap());
} else if retry.is_none() {
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
payment_id,
payment_hash: PaymentHash(invoice.payment_hash().clone().into_inner()),
network_update: None,
- rejected_by_dest: true,
+ payment_failed_permanently: true,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: vec![],
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path,
short_channel_id,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat),
short_channel_id: None,
payment_id,
payment_hash,
network_update: None,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: false,
path: TestRouter::path_for_value(final_value_msat / 2),
short_channel_id: None,
// treated this as "HTLC complete" and dropped the retry counter, causing us to retry again
// if the final HTLC failed.
expected_events.borrow_mut().push_back(&|ev: &Event| {
- if let Event::PaymentPathFailed { rejected_by_dest, all_paths_failed, .. } = ev {
- assert!(!rejected_by_dest);
+ if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
+ assert!(!payment_failed_permanently);
assert!(all_paths_failed);
} else { panic!("Unexpected event"); }
});
commitment_signed_dance!(nodes[0], nodes[1], &bs_fail_update.commitment_signed, false, true);
expected_events.borrow_mut().push_back(&|ev: &Event| {
- if let Event::PaymentPathFailed { rejected_by_dest, all_paths_failed, .. } = ev {
- assert!(!rejected_by_dest);
+ if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
+ assert!(!payment_failed_permanently);
assert!(all_paths_failed);
} else { panic!("Unexpected event"); }
});
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 2);
- if let Event::PaymentPathFailed { payment_hash, rejected_by_dest, .. } = events[0] {
+ if let Event::PaymentPathFailed { payment_hash, payment_failed_permanently, .. } = events[0] {
assert_eq!(payment_hash, payment_hash_1);
- assert!(rejected_by_dest);
+ assert!(payment_failed_permanently);
} else { panic!("Unexpected event!"); }
match events[1] {
Event::PendingHTLCsForwardable { .. } => { },
pending_events.push(events::Event::PaymentPathFailed {
payment_id: Some(payment_id),
payment_hash,
- rejected_by_dest: false,
+ payment_failed_permanently: false,
network_update: None,
all_paths_failed: payment.get().remaining_parts() == 0,
path: path.clone(),
events::Event::PaymentPathFailed {
payment_id: Some(payment_id),
payment_hash: payment_hash.clone(),
- rejected_by_dest: !payment_retryable,
+ payment_failed_permanently: !payment_retryable,
network_update,
all_paths_failed,
path: path.clone(),
events::Event::PaymentPathFailed {
payment_id: Some(payment_id),
payment_hash: payment_hash.clone(),
- rejected_by_dest: false,
+ payment_failed_permanently: false,
network_update: None,
all_paths_failed,
path: path.clone(),
#[cfg(test)]
macro_rules! expect_payment_failed_with_update {
- ($node: expr, $expected_payment_hash: expr, $rejected_by_dest: expr, $scid: expr, $chan_closed: expr) => {
+ ($node: expr, $expected_payment_hash: expr, $payment_failed_permanently: expr, $scid: expr, $chan_closed: expr) => {
$crate::ln::functional_test_utils::expect_payment_failed_conditions(
- &$node, $expected_payment_hash, $rejected_by_dest,
+ &$node, $expected_payment_hash, $payment_failed_permanently,
$crate::ln::functional_test_utils::PaymentFailedConditions::new()
.blamed_scid($scid).blamed_chan_closed($chan_closed));
}
#[cfg(test)]
macro_rules! expect_payment_failed {
- ($node: expr, $expected_payment_hash: expr, $rejected_by_dest: expr $(, $expected_error_code: expr, $expected_error_data: expr)*) => {
+ ($node: expr, $expected_payment_hash: expr, $payment_failed_permanently: expr $(, $expected_error_code: expr, $expected_error_data: expr)*) => {
#[allow(unused_mut)]
let mut conditions = $crate::ln::functional_test_utils::PaymentFailedConditions::new();
$(
conditions = conditions.expected_htlc_error_data($expected_error_code, &$expected_error_data);
)*
- $crate::ln::functional_test_utils::expect_payment_failed_conditions(&$node, $expected_payment_hash, $rejected_by_dest, conditions);
+ $crate::ln::functional_test_utils::expect_payment_failed_conditions(&$node, $expected_payment_hash, $payment_failed_permanently, conditions);
};
}
pub fn expect_payment_failed_conditions_event<'a, 'b, 'c, 'd, 'e>(
node: &'a Node<'b, 'c, 'd>, payment_failed_event: Event, expected_payment_hash: PaymentHash,
- expected_rejected_by_dest: bool, conditions: PaymentFailedConditions<'e>
+ expected_payment_failed_permanently: bool, conditions: PaymentFailedConditions<'e>
) {
let expected_payment_id = match payment_failed_event {
- Event::PaymentPathFailed { payment_hash, rejected_by_dest, path, retry, payment_id, network_update, short_channel_id,
+ Event::PaymentPathFailed { payment_hash, payment_failed_permanently, path, retry, payment_id, network_update, short_channel_id,
#[cfg(test)]
error_code,
#[cfg(test)]
error_data, .. } => {
assert_eq!(payment_hash, expected_payment_hash, "unexpected payment_hash");
- assert_eq!(rejected_by_dest, expected_rejected_by_dest, "unexpected rejected_by_dest value");
+ assert_eq!(payment_failed_permanently, expected_payment_failed_permanently, "unexpected payment_failed_permanently value");
assert!(retry.is_some(), "expected retry.is_some()");
assert_eq!(retry.as_ref().unwrap().final_value_msat, path.last().unwrap().fee_msat, "Retry amount should match last hop in path");
assert_eq!(retry.as_ref().unwrap().payment_params.payee_pubkey, path.last().unwrap().pubkey, "Retry payee node_id should match last hop in path");
}
pub fn expect_payment_failed_conditions<'a, 'b, 'c, 'd, 'e>(
- node: &'a Node<'b, 'c, 'd>, expected_payment_hash: PaymentHash, expected_rejected_by_dest: bool,
+ node: &'a Node<'b, 'c, 'd>, expected_payment_hash: PaymentHash, expected_payment_failed_permanently: bool,
conditions: PaymentFailedConditions<'e>
) {
let mut events = node.node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
- expect_payment_failed_conditions_event(node, events.pop().unwrap(), expected_payment_hash, expected_rejected_by_dest, conditions);
+ expect_payment_failed_conditions_event(node, events.pop().unwrap(), expected_payment_hash, expected_payment_failed_permanently, conditions);
}
pub fn send_along_route_with_secret<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, route: Route, expected_paths: &[&[&Node<'a, 'b, 'c>]], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: PaymentSecret) -> PaymentId {
let events = origin_node.node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
let expected_payment_id = match events[0] {
- Event::PaymentPathFailed { payment_hash, rejected_by_dest, all_paths_failed, ref path, ref payment_id, .. } => {
+ Event::PaymentPathFailed { payment_hash, payment_failed_permanently, all_paths_failed, ref path, ref payment_id, .. } => {
assert_eq!(payment_hash, our_payment_hash);
- assert!(rejected_by_dest);
+ assert!(payment_failed_permanently);
assert_eq!(all_paths_failed, i == expected_paths.len() - 1);
for (idx, hop) in expected_route.iter().enumerate() {
assert_eq!(hop.node.get_our_node_id(), path[idx].pubkey);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 3);
match events[0] {
- Event::PaymentPathFailed { ref payment_hash, rejected_by_dest: _, ref network_update, .. } => {
+ Event::PaymentPathFailed { ref payment_hash, ref network_update, .. } => {
assert!(failed_htlcs.insert(payment_hash.0));
// If we delivered B's RAA we got an unknown preimage error, not something
// that we should update our routing table for.
_ => panic!("Unexpected event"),
}
match events[1] {
- Event::PaymentPathFailed { ref payment_hash, rejected_by_dest: _, ref network_update, .. } => {
+ Event::PaymentPathFailed { ref payment_hash, ref network_update, .. } => {
assert!(failed_htlcs.insert(payment_hash.0));
assert!(network_update.is_some());
},
_ => panic!("Unexpected event"),
}
match events[2] {
- Event::PaymentPathFailed { ref payment_hash, rejected_by_dest: _, ref network_update, .. } => {
+ Event::PaymentPathFailed { ref payment_hash, ref network_update, .. } => {
assert!(failed_htlcs.insert(payment_hash.0));
assert!(network_update.is_some());
},
_ => panic!("Unexpected event"),
}
match events[1] {
- Event::PaymentPathFailed { payment_hash, rejected_by_dest, .. } => {
+ Event::PaymentPathFailed { payment_hash, payment_failed_permanently, .. } => {
assert_eq!(payment_hash, payment_hash_5);
- assert!(rejected_by_dest);
+ assert!(payment_failed_permanently);
},
_ => panic!("Unexpected event"),
}
let mut as_failds = HashSet::new();
let mut as_updates = 0;
for event in as_events.iter() {
- if let &Event::PaymentPathFailed { ref payment_hash, ref rejected_by_dest, ref network_update, .. } = event {
+ if let &Event::PaymentPathFailed { ref payment_hash, ref payment_failed_permanently, ref network_update, .. } = event {
assert!(as_failds.insert(*payment_hash));
if *payment_hash != payment_hash_2 {
- assert_eq!(*rejected_by_dest, deliver_last_raa);
+ assert_eq!(*payment_failed_permanently, deliver_last_raa);
} else {
- assert!(!rejected_by_dest);
+ assert!(!payment_failed_permanently);
}
if network_update.is_some() {
as_updates += 1;
let mut bs_failds = HashSet::new();
let mut bs_updates = 0;
for event in bs_events.iter() {
- if let &Event::PaymentPathFailed { ref payment_hash, ref rejected_by_dest, ref network_update, .. } = event {
+ if let &Event::PaymentPathFailed { ref payment_hash, ref payment_failed_permanently, ref network_update, .. } = event {
assert!(bs_failds.insert(*payment_hash));
if *payment_hash != payment_hash_1 && *payment_hash != payment_hash_5 {
- assert_eq!(*rejected_by_dest, deliver_last_raa);
+ assert_eq!(*payment_failed_permanently, deliver_last_raa);
} else {
- assert!(!rejected_by_dest);
+ assert!(!payment_failed_permanently);
}
if network_update.is_some() {
bs_updates += 1;
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match &events[0] {
- &Event::PaymentPathFailed { ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, ref error_data, .. } => {
+ &Event::PaymentPathFailed { ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, ref error_data, .. } => {
assert_eq!(our_payment_id, *payment_id.as_ref().unwrap());
assert_eq!(our_payment_hash.clone(), *payment_hash);
- assert_eq!(*rejected_by_dest, false);
+ assert_eq!(*payment_failed_permanently, false);
assert_eq!(*all_paths_failed, true);
assert_eq!(*network_update, None);
assert_eq!(*short_channel_id, None);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match &events[0] {
- &Event::PaymentPathFailed { ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, ref error_data, .. } => {
+ &Event::PaymentPathFailed { ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, ref error_data, .. } => {
assert_eq!(payment_id_2, *payment_id.as_ref().unwrap());
assert_eq!(payment_hash_2.clone(), *payment_hash);
- assert_eq!(*rejected_by_dest, false);
+ assert_eq!(*payment_failed_permanently, false);
assert_eq!(*all_paths_failed, true);
assert_eq!(*network_update, None);
assert_eq!(*short_channel_id, None);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
- if let &Event::PaymentPathFailed { ref rejected_by_dest, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, .. } = &events[0] {
- assert_eq!(*rejected_by_dest, !expected_retryable);
+ if let &Event::PaymentPathFailed { ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref short_channel_id, ref error_code, .. } = &events[0] {
+ assert_eq!(*payment_failed_permanently, !expected_retryable);
assert_eq!(*all_paths_failed, true);
assert_eq!(*error_code, expected_error_code);
if expected_channel_update.is_some() {
network_graph.handle_event(&Event::PaymentPathFailed {
payment_id: None,
payment_hash: PaymentHash([0; 32]),
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: vec![],
network_update: Some(NetworkUpdate::ChannelUpdateMessage {
network_graph.handle_event(&Event::PaymentPathFailed {
payment_id: None,
payment_hash: PaymentHash([0; 32]),
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: vec![],
network_update: Some(NetworkUpdate::ChannelFailure {
network_graph.handle_event(&Event::PaymentPathFailed {
payment_id: None,
payment_hash: PaymentHash([0; 32]),
- rejected_by_dest: false,
+ payment_failed_permanently: false,
all_paths_failed: true,
path: vec![],
network_update: Some(NetworkUpdate::ChannelFailure {
/// Indicates the payment was rejected for some reason by the recipient. This implies that
/// the payment has failed, not just the route in question. If this is not set, you may
/// retry the payment via a different route.
- rejected_by_dest: bool,
+ payment_failed_permanently: bool,
/// Any failure information conveyed via the Onion return packet by a node along the failed
/// payment route.
///
});
},
&Event::PaymentPathFailed {
- ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update,
+ ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update,
ref all_paths_failed, ref path, ref short_channel_id, ref retry,
#[cfg(test)]
ref error_code,
write_tlv_fields!(writer, {
(0, payment_hash, required),
(1, network_update, option),
- (2, rejected_by_dest, required),
+ (2, payment_failed_permanently, required),
(3, all_paths_failed, required),
(5, path, vec_type),
(7, short_channel_id, option),
#[cfg(test)]
let error_data = Readable::read(reader)?;
let mut payment_hash = PaymentHash([0; 32]);
- let mut rejected_by_dest = false;
+ let mut payment_failed_permanently = false;
let mut network_update = None;
let mut all_paths_failed = Some(true);
let mut path: Option<Vec<RouteHop>> = Some(vec![]);
read_tlv_fields!(reader, {
(0, payment_hash, required),
(1, network_update, ignorable),
- (2, rejected_by_dest, required),
+ (2, payment_failed_permanently, required),
(3, all_paths_failed, option),
(5, path, vec_type),
(7, short_channel_id, option),
Ok(Some(Event::PaymentPathFailed {
payment_id,
payment_hash,
- rejected_by_dest,
+ payment_failed_permanently,
network_update,
all_paths_failed: all_paths_failed.unwrap(),
path: path.unwrap(),