Add failure case on test unblided receive
What changed, and why it matters
This commit only adds a new test case to existing test code. It makes an existing test run twice—once for a successful payment claim and once for a failed payment—so the software's behavior in both situations is checked automatically. No production code was changed, so it cannot directly affect real users or introduce a security vulnerability.
No security action required. Treat as routine test improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors test_trampoline_unblinded_receive in lightning/src/ln/blinded_payment_tests.rs into a helper do_test_trampoline_unblinded_receive(success: bool) and calls it with both true and false. When success is false, it calls fail_payment instead of claim_payment. This is purely a test-coverage expansion for trampoline unblinded receive paths; no library logic is modified.
Changed components
lightning/src/ln/blinded_payment_tests.rsInspect captured patch +11 / −3
diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs
index d8dc094..8959e34 100644
--- a/lightning/src/ln/blinded_payment_tests.rs
+++ b/lightning/src/ln/blinded_payment_tests.rs
@@ -2274,8 +2274,7 @@ fn test_trampoline_single_hop_receive() {
do_test_trampoline_single_hop_receive(false);
}
-#[test]
-fn test_trampoline_unblinded_receive() {
+fn do_test_trampoline_unblinded_receive(success: bool) {
// Simulate a payment of A (0) -> B (1) -> C(Trampoline) (2)
const TOTAL_NODE_COUNT: usize = 3;
@@ -2416,8 +2415,17 @@ fn test_trampoline_unblinded_receive() {
let args = PassAlongPathArgs::new(&nodes[0], route, amt_msat, payment_hash, first_message_event)
.with_payment_secret(payment_secret);
do_pass_along_path(args);
+ if success {
+ claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage);
+ } else {
+ fail_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_hash);
+ }
+}
- claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage);
+#[test]
+fn test_trampoline_unblinded_receive() {
+ do_test_trampoline_unblinded_receive(true);
+ do_test_trampoline_unblinded_receive(false);
}
#[test]
Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.