Skip to content

Commit 037403e

Browse files
committed
Expand HTLCDestination variants for Trampoline forwards
The previously existing `HTLCDestination` do not map nicely to the failure event of a Trampoline forward, so we introduce a new variant to fill the gap.
1 parent 2e49bc3 commit 037403e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lightning/src/events/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,14 @@ pub enum HTLCDestination {
490490
/// Short channel id we are requesting to forward an HTLC to.
491491
requested_forward_scid: u64
492492
},
493+
/// We couldn't forward to the next Trampoline node. That may happen if we cannot find a route,
494+
/// or if the route we found didn't work out
495+
FailedTrampolineForward {
496+
/// The node ID of the next Trampoline hop we tried forwarding to
497+
requested_next_node_id: PublicKey,
498+
/// The channel we tried forwarding over, if we have settled on one
499+
forward_scid: Option<u64>,
500+
},
493501
/// We couldn't decode the incoming onion to obtain the forwarding details.
494502
InvalidOnion,
495503
/// Failure scenario where an HTLC may have been forwarded to be intended for us,
@@ -523,6 +531,10 @@ impl_writeable_tlv_based_enum_upgradable!(HTLCDestination,
523531
(4, FailedPayment) => {
524532
(0, payment_hash, required),
525533
},
534+
(5, FailedTrampolineForward) => {
535+
(0, requested_next_node_id, required),
536+
(2, forward_scid, option),
537+
},
526538
);
527539

528540
/// Will be used in [`Event::HTLCIntercepted`] to identify the next hop in the HTLC's path.

0 commit comments

Comments
 (0)