@@ -653,6 +653,7 @@ impl SentHTLCId {
653653 short_channel_id: hop_data.short_channel_id,
654654 htlc_id: hop_data.htlc_id,
655655 },
656+ HTLCSource::TrampolineForward { .. } => todo!(),
656657 HTLCSource::OutboundRoute { session_priv, .. } => {
657658 Self::OutboundRoute { session_priv: session_priv.secret_bytes() }
658659 },
@@ -676,13 +677,25 @@ type PerSourcePendingForward =
676677type FailedHTLCForward = (HTLCSource, PaymentHash, HTLCFailReason, HTLCHandlingFailureType);
677678
678679mod fuzzy_channelmanager {
680+ use crate::routing::router::RouteHop;
681+
679682 use super::*;
680683
681684 /// Tracks the inbound corresponding to an outbound HTLC
682685 #[allow(clippy::derive_hash_xor_eq)] // Our Hash is faithful to the data, we just don't have SecretKey::hash
683686 #[derive(Clone, Debug, PartialEq, Eq)]
684687 pub enum HTLCSource {
685688 PreviousHopData(HTLCPreviousHopData),
689+ TrampolineForward {
690+ /// We might be forwarding an incoming payment that was received over MPP, and therefore
691+ /// need to store the vector of corresponding `HTLCPreviousHopId` values.
692+ previous_hop_data: Vec<HTLCPreviousHopData>,
693+ incoming_trampoline_shared_secret: [u8; 32],
694+ hops: Vec<RouteHop>,
695+ /// In order to decode inter-Trampoline errors, we need to store the session_priv key
696+ /// given we're effectively creating new outbound routes.
697+ session_priv: SecretKey,
698+ },
686699 OutboundRoute {
687700 path: Path,
688701 session_priv: SecretKey,
@@ -745,6 +758,18 @@ impl core::hash::Hash for HTLCSource {
745758 first_hop_htlc_msat.hash(hasher);
746759 bolt12_invoice.hash(hasher);
747760 },
761+ HTLCSource::TrampolineForward {
762+ previous_hop_data,
763+ incoming_trampoline_shared_secret,
764+ hops,
765+ session_priv,
766+ } => {
767+ 2u8.hash(hasher);
768+ previous_hop_data.hash(hasher);
769+ incoming_trampoline_shared_secret.hash(hasher);
770+ hops.hash(hasher);
771+ session_priv[..].hash(hasher);
772+ },
748773 }
749774 }
750775}
@@ -7944,6 +7969,7 @@ where
79447969 None,
79457970 ));
79467971 },
7972+ HTLCSource::TrampolineForward { .. } => todo!(),
79477973 }
79487974 }
79497975
@@ -8661,6 +8687,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
86618687 },
86628688 );
86638689 },
8690+ HTLCSource::TrampolineForward { .. } => todo!(),
86648691 }
86658692 }
86668693
@@ -14952,6 +14979,24 @@ impl Readable for HTLCSource {
1495214979 })
1495314980 }
1495414981 1 => Ok(HTLCSource::PreviousHopData(Readable::read(reader)?)),
14982+ 2 => {
14983+ let mut previous_hop_data = Vec::new();
14984+ let mut incoming_trampoline_shared_secret: crate::util::ser::RequiredWrapper<[u8; 32]> = crate::util::ser::RequiredWrapper(None);
14985+ let mut session_priv: crate::util::ser::RequiredWrapper<SecretKey> = crate::util::ser::RequiredWrapper(None);
14986+ let mut hops = Vec::new();
14987+ read_tlv_fields!(reader, {
14988+ (0, previous_hop_data, required_vec),
14989+ (2, incoming_trampoline_shared_secret, required),
14990+ (4, session_priv, required),
14991+ (6, hops, required_vec),
14992+ });
14993+ Ok(HTLCSource::TrampolineForward {
14994+ previous_hop_data,
14995+ incoming_trampoline_shared_secret: incoming_trampoline_shared_secret.0.unwrap(),
14996+ hops,
14997+ session_priv: session_priv.0.unwrap(),
14998+ })
14999+ },
1495515000 _ => Err(DecodeError::UnknownRequiredFeature),
1495615001 }
1495715002 }
@@ -14984,6 +15029,22 @@ impl Writeable for HTLCSource {
1498415029 1u8.write(writer)?;
1498515030 field.write(writer)?;
1498615031 },
15032+ HTLCSource::TrampolineForward {
15033+ previous_hop_data: previous_hop_data_ref,
15034+ ref incoming_trampoline_shared_secret,
15035+ ref session_priv,
15036+ hops: hops_ref,
15037+ } => {
15038+ 2u8.write(writer)?;
15039+ let previous_hop_data = previous_hop_data_ref.clone();
15040+ let hops = hops_ref.clone();
15041+ write_tlv_fields!(writer, {
15042+ (0, previous_hop_data, required_vec),
15043+ (2, incoming_trampoline_shared_secret, required),
15044+ (4, session_priv, required),
15045+ (6, hops, required_vec),
15046+ });
15047+ },
1498715048 }
1498815049 Ok(())
1498915050 }
@@ -16427,6 +16488,7 @@ where
1642716488 } else { true }
1642816489 });
1642916490 },
16491+ HTLCSource::TrampolineForward { .. } => todo!(),
1643016492 HTLCSource::OutboundRoute {
1643116493 payment_id,
1643216494 session_priv,
0 commit comments