Skip to content

Commit 9268af2

Browse files
a-mpcharik-so
andcommitted
Expand HTLCDestination variants for Trampoline forwards
The previously existing `HTLCDestination` do not map nicely to the failure vent of a Trampoline forward, so we introduce a new variant to fill the gap. Co-authored-by: Arik Sosman <git@arik.io>
1 parent 9f47d5c commit 9268af2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lightning/src/events/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,14 @@ pub enum HTLCHandlingFailureType {
545545
/// Short channel id we are requesting to forward an HTLC to.
546546
requested_forward_scid: u64,
547547
},
548+
/// We couldn't forward to the next Trampoline node. That may happen if we cannot find a route,
549+
/// or if the route we found didn't work out.
550+
FailedTrampolineForward {
551+
/// The node ID of the next Trampoline hop we tried forwarding to.
552+
requested_next_node_id: PublicKey,
553+
/// The channel we tried forwarding over, if we have settled to one.
554+
forward_scid: Option<u64>,
555+
},
548556
/// We couldn't decode the incoming onion to obtain the forwarding details.
549557
InvalidOnion,
550558
/// Failure scenario where an HTLC may have been forwarded to be intended for us,
@@ -578,6 +586,10 @@ impl_writeable_tlv_based_enum_upgradable!(HTLCHandlingFailureType,
578586
(4, Receive) => {
579587
(0, payment_hash, required),
580588
},
589+
(5, FailedTrampolineForward) => {
590+
(0, requested_next_node_id, required),
591+
(2, forward_scid, option),
592+
}
581593
);
582594

583595
/// The reason for HTLC failures in [`Event::HTLCHandlingFailed`].

0 commit comments

Comments
 (0)