Skip to content

Commit 39758da

Browse files
committed
Keep track of Trampoline support in blinded tails
1 parent 8da30df commit 39758da

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,8 @@ fn route_blinding_spec_test_vector() {
15151515
hops: blinded_hops,
15161516
blinding_point: bob_blinding_point,
15171517
excess_final_cltv_expiry_delta: 0,
1518-
final_value_msat: amt_msat
1518+
final_value_msat: amt_msat,
1519+
final_hop_supports_trampoline: false
15191520
}),
15201521
};
15211522
let cur_height = 747_000;

lightning/src/routing/router.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,16 @@ pub struct BlindedTail {
404404
pub excess_final_cltv_expiry_delta: u32,
405405
/// The total amount paid on this [`Path`], excluding the fees.
406406
pub final_value_msat: u64,
407+
/// Used for determining the type of Trampoline path to construct
408+
pub final_hop_supports_trampoline: bool
407409
}
408410

409411
impl_writeable_tlv_based!(BlindedTail, {
410412
(0, hops, required_vec),
411413
(2, blinding_point, required),
412414
(4, excess_final_cltv_expiry_delta, required),
413415
(6, final_value_msat, required),
416+
(8, final_hop_supports_trampoline, required),
414417
});
415418

416419
/// A path in a [`Route`] to the payment recipient. Must always be at least length one.
@@ -3343,6 +3346,7 @@ where L::Target: Logger {
33433346
blinding_point: blinded_path.blinding_point(),
33443347
excess_final_cltv_expiry_delta: 0,
33453348
final_value_msat: h.fee_msat,
3349+
final_hop_supports_trampoline: false
33463350
})
33473351
} else { None }
33483352
});
@@ -7692,6 +7696,7 @@ mod tests {
76927696
blinding_point: ln_test_utils::pubkey(43),
76937697
excess_final_cltv_expiry_delta: 40,
76947698
final_value_msat: 100,
7699+
final_hop_supports_trampoline: false,
76957700
})}, Path {
76967701
hops: vec![RouteHop {
76977702
pubkey: ln_test_utils::pubkey(51),
@@ -7718,6 +7723,7 @@ mod tests {
77187723
blinding_point: ln_test_utils::pubkey(47),
77197724
excess_final_cltv_expiry_delta: 41,
77207725
final_value_msat: 101,
7726+
final_hop_supports_trampoline: false,
77217727
});
77227728
let encoded_route = route.encode();
77237729
let decoded_route: Route = Readable::read(&mut Cursor::new(&encoded_route[..])).unwrap();
@@ -7754,6 +7760,7 @@ mod tests {
77547760
blinding_point: ln_test_utils::pubkey(48),
77557761
excess_final_cltv_expiry_delta: 0,
77567762
final_value_msat: 200,
7763+
final_hop_supports_trampoline: false,
77577764
}),
77587765
};
77597766
inflight_htlcs.process_path(&path, ln_test_utils::pubkey(44));
@@ -7792,6 +7799,7 @@ mod tests {
77927799
blinding_point: ln_test_utils::pubkey(44),
77937800
excess_final_cltv_expiry_delta: 0,
77947801
final_value_msat: 200,
7802+
final_hop_supports_trampoline: false,
77957803
}),
77967804
}], route_params: None};
77977805

lightning/src/routing/scoring.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,7 @@ mod tests {
34023402
blinding_point: test_utils::pubkey(42),
34033403
excess_final_cltv_expiry_delta: recipient_hop.cltv_expiry_delta,
34043404
final_value_msat: recipient_hop.fee_msat,
3405+
final_hop_supports_trampoline: false
34053406
});
34063407

34073408
// Check the liquidity before and after scoring payment failures to ensure the blinded path's

0 commit comments

Comments
 (0)