Skip to content

Commit fcc2651

Browse files
committed
Add failure case on test unblided receive
Previously this commit, test only check for succesfully claimed case. Now tests that successfully fail the HTLC and sender can read the error.
1 parent 94b5b1d commit fcc2651

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,8 +2274,7 @@ fn test_trampoline_single_hop_receive() {
22742274
do_test_trampoline_single_hop_receive(false);
22752275
}
22762276

2277-
#[test]
2278-
fn test_trampoline_unblinded_receive() {
2277+
fn do_test_trampoline_unblinded_receive(success: bool) {
22792278
// Simulate a payment of A (0) -> B (1) -> C(Trampoline) (2)
22802279

22812280
const TOTAL_NODE_COUNT: usize = 3;
@@ -2416,8 +2415,17 @@ fn test_trampoline_unblinded_receive() {
24162415
let args = PassAlongPathArgs::new(&nodes[0], route, amt_msat, payment_hash, first_message_event)
24172416
.with_payment_secret(payment_secret);
24182417
do_pass_along_path(args);
2418+
if success {
2419+
claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage);
2420+
} else {
2421+
fail_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_hash);
2422+
}
2423+
}
24192424

2420-
claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage);
2425+
#[test]
2426+
fn test_trampoline_unblinded_receive() {
2427+
do_test_trampoline_unblinded_receive(true);
2428+
do_test_trampoline_unblinded_receive(false);
24212429
}
24222430

24232431
#[test]

0 commit comments

Comments
 (0)