Skip to content

Commit 2a7ed23

Browse files
committed
f test retry data in events matches
1 parent a43593b commit 2a7ed23

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lightning/src/ln/functional_test_utils.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1114,9 +1114,12 @@ macro_rules! expect_payment_failed_with_update {
11141114
let events = $node.node.get_and_clear_pending_events();
11151115
assert_eq!(events.len(), 1);
11161116
match events[0] {
1117-
Event::PaymentPathFailed { ref payment_hash, rejected_by_dest, ref network_update, ref error_code, ref error_data, .. } => {
1117+
Event::PaymentPathFailed { ref payment_hash, rejected_by_dest, ref network_update, ref error_code, ref error_data, ref path, ref retry, .. } => {
11181118
assert_eq!(*payment_hash, $expected_payment_hash, "unexpected payment_hash");
11191119
assert_eq!(rejected_by_dest, $rejected_by_dest, "unexpected rejected_by_dest value");
1120+
assert!(retry.is_some(), "expected retry.is_some()");
1121+
assert_eq!(retry.as_ref().unwrap().final_value_msat, path.last().unwrap().fee_msat, "Retry amount should match last hop in path");
1122+
assert_eq!(retry.as_ref().unwrap().payee.pubkey, path.last().unwrap().pubkey, "Retry payee node_id should match last hop in path");
11201123
assert!(error_code.is_some(), "expected error_code.is_some() = true");
11211124
assert!(error_data.is_some(), "expected error_data.is_some() = true");
11221125
match network_update {
@@ -1143,9 +1146,12 @@ macro_rules! expect_payment_failed {
11431146
let events = $node.node.get_and_clear_pending_events();
11441147
assert_eq!(events.len(), 1);
11451148
match events[0] {
1146-
Event::PaymentPathFailed { ref payment_hash, rejected_by_dest, network_update: _, ref error_code, ref error_data, .. } => {
1149+
Event::PaymentPathFailed { ref payment_hash, rejected_by_dest, network_update: _, ref error_code, ref error_data, ref path, ref retry, .. } => {
11471150
assert_eq!(*payment_hash, $expected_payment_hash, "unexpected payment_hash");
11481151
assert_eq!(rejected_by_dest, $rejected_by_dest, "unexpected rejected_by_dest value");
1152+
assert!(retry.is_some(), "expected retry.is_some()");
1153+
assert_eq!(retry.as_ref().unwrap().final_value_msat, path.last().unwrap().fee_msat, "Retry amount should match last hop in path");
1154+
assert_eq!(retry.as_ref().unwrap().payee.pubkey, path.last().unwrap().pubkey, "Retry payee node_id should match last hop in path");
11491155
assert!(error_code.is_some(), "expected error_code.is_some() = true");
11501156
assert!(error_data.is_some(), "expected error_data.is_some() = true");
11511157
$(

0 commit comments

Comments
 (0)