Skip to content

Commit dc39168

Browse files
committed
f handle trampoline
1 parent 4cbd556 commit dc39168

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lightning/src/routing/router.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,15 @@ impl InFlightHtlcs {
392392
if tail.hops.len() > 1 {
393393
// Single-hop blinded paths aren't really "blinded" paths, as they terminate at the
394394
// introduction point. In that case, we don't need to track anything.
395-
let last_hop = path.hops.last().unwrap();
396-
let intro_node = NodeId::from_pubkey(&last_hop.pubkey);
395+
let last_trampoline_hop =
396+
tail.trampoline_hops.last().map(|hop| (hop.pubkey, hop.fee_msat));
397+
let last_normal_hop = path.hops.last().unwrap();
398+
let last_hop = last_trampoline_hop
399+
.unwrap_or((last_normal_hop.pubkey, last_normal_hop.fee_msat));
400+
let intro_node = NodeId::from_pubkey(&last_hop.0);
397401
// The amount we send into the blinded path is the sum of the blinded path final
398402
// amount and the fee we pay in it, which is the `fee_msat` of the last hop.
399-
let blinded_path_sent_amt = last_hop.fee_msat + cumulative_msat;
403+
let blinded_path_sent_amt = last_hop.1 + cumulative_msat;
400404
self.blinded_hops
401405
.entry((intro_node, tail.blinding_point))
402406
.and_modify(|used_liquidity_msat| *used_liquidity_msat += blinded_path_sent_amt)

0 commit comments

Comments
 (0)