ln: add TrampolineForward SendHTLCId variant
What changed, and why it matters
This commit adds a new internal identifier type for tracking forwarded Lightning payments that use Trampoline routing. It is a small, structural code change that does not appear to fix or introduce a security vulnerability on its own. It simply lets the software distinguish Trampoline forwards from other kinds of payment routes when recording which HTLCs were sent.
No security action required. Review as part of normal Trampoline routing feature development and ensure downstream code that matches on SentHTLCId handles the new variant.
Security signals we found
No memory-safety issues visible in diff
No input validation changes
No cryptographic operation changes
No privilege or authorization changes
No existing variant behavior modified
Purely additive enum/serialization change
Evidence from the diff
The patch extends the SentHTLCId enum in lightning/src/ln/channelmanager.rs with a TrampolineForward { session_priv: [u8; 32] } variant and adds corresponding serialization logic. This identifier is used internally to correlate outbound HTLCs with their source. The change is additive and does not modify existing variant handling, bounds checks, or cryptographic operations.
Changed components
lightning/src/ln/channelmanager.rsSentHTLCId enum serializationInspect captured patch +4 / −0
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2520d68..19322ba 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -756,6 +756,7 @@ impl Default for OptionalOfferPaymentParams {
pub(crate) enum SentHTLCId {
PreviousHopData { prev_outbound_scid_alias: u64, htlc_id: u64 },
OutboundRoute { session_priv: [u8; SECRET_KEY_SIZE] },
+ TrampolineForward { session_priv: [u8; SECRET_KEY_SIZE] },
}
impl SentHTLCId {
pub(crate) fn from_source(source: &HTLCSource) -> Self {
@@ -778,6 +779,9 @@ impl_writeable_tlv_based_enum!(SentHTLCId,
(2, OutboundRoute) => {
(0, session_priv, required),
},
+ (4, TrampolineForward) => {
+ (0, session_priv, required),
+ },
);
type FailedHTLCForward = (HTLCSource, PaymentHash, HTLCFailReason, HTLCHandlingFailureType);
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.