Skip to content

Commit cf1cea0

Browse files
committed
verify node_b recieved payment for end-to-end verification
1 parent ce5235f commit cf1cea0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/integration_tests_rust.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,4 +1428,24 @@ fn spontaneous_send_with_custom_preimage() {
14281428
} else {
14291429
panic!("Expected a spontaneous PaymentKind with a preimage");
14301430
}
1431+
1432+
// Verify receiver side (node_b)
1433+
expect_payment_received_event!(node_b, amount_msat);
1434+
let receiver_payments: Vec<PaymentDetails> = node_b.list_payments_with_filter(|p| {
1435+
p.direction == PaymentDirection::Inbound
1436+
&& matches!(p.kind, PaymentKind::Spontaneous { .. })
1437+
});
1438+
1439+
assert_eq!(receiver_payments.len(), 1);
1440+
let receiver_details = &receiver_payments[0];
1441+
assert_eq!(receiver_details.status, PaymentStatus::Succeeded);
1442+
assert_eq!(receiver_details.amount_msat, Some(amount_msat));
1443+
assert_eq!(receiver_details.direction, PaymentDirection::Inbound);
1444+
1445+
// Verify receiver also has the same preimage
1446+
if let PaymentKind::Spontaneous { preimage: Some(pi), .. } = receiver_details.kind {
1447+
assert_eq!(pi.0, custom_bytes);
1448+
} else {
1449+
panic!("Expected receiver to have spontaneous PaymentKind with preimage");
1450+
}
14311451
}

0 commit comments

Comments
 (0)