Skip to content

Commit 7b81f6c

Browse files
committed
Decode inner Trampoline forwards [expound]
1 parent d447558 commit 7b81f6c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lightning/src/ln/msgs.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ mod fuzzy_internal_msgs {
18131813

18141814
#[allow(unused)]
18151815
pub struct InboundTrampolineForwardPayload {
1816-
pub next_node_id: NodeId,
1816+
pub outgoing_node_id: NodeId,
18171817
/// The value, in msat, of the payment after this hop's fee is deducted.
18181818
pub amt_to_forward: u64,
18191819
pub outgoing_cltv_value: u32,
@@ -2925,6 +2925,7 @@ impl<NS: Deref> ReadableArgs<(Option<PublicKey>, NS)> for InboundOnionPayload wh
29252925
let mut payment_data: Option<FinalOnionHopData> = None;
29262926
let mut encrypted_tlvs_opt: Option<WithoutLength<Vec<u8>>> = None;
29272927
let mut intro_node_blinding_point = None;
2928+
let mut outgoing_node_id: Option<NodeId> = None;
29282929
let mut payment_metadata: Option<WithoutLength<Vec<u8>>> = None;
29292930
let mut total_msat = None;
29302931
let mut keysend_preimage: Option<PaymentPreimage> = None;
@@ -2941,6 +2942,7 @@ impl<NS: Deref> ReadableArgs<(Option<PublicKey>, NS)> for InboundOnionPayload wh
29412942
(8, payment_data, option),
29422943
(10, encrypted_tlvs_opt, option),
29432944
(12, intro_node_blinding_point, option),
2945+
(14, outgoing_node_id, option),
29442946
(16, payment_metadata, option),
29452947
(18, total_msat, (option, encoding: (u64, HighZeroBytesDroppedBigSize))),
29462948
(20, trampoline_onion_packet, option),
@@ -3022,6 +3024,15 @@ impl<NS: Deref> ReadableArgs<(Option<PublicKey>, NS)> for InboundOnionPayload wh
30223024
amt_to_forward: amt.ok_or(DecodeError::InvalidValue)?,
30233025
outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?,
30243026
}))
3027+
} else if let Some(outgoing_node_id) = outgoing_node_id {
3028+
if payment_data.is_some() || payment_metadata.is_some() || encrypted_tlvs_opt.is_some() ||
3029+
total_msat.is_some() || invoice_request.is_some()
3030+
{ return Err(DecodeError::InvalidValue) }
3031+
Ok(Self::TrampolineForward(InboundTrampolineForwardPayload {
3032+
outgoing_node_id,
3033+
amt_to_forward: amt.ok_or(DecodeError::InvalidValue)?,
3034+
outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?,
3035+
}))
30253036
} else if let Some(trampoline_onion_packet) = trampoline_onion_packet {
30263037
if payment_metadata.is_some() || encrypted_tlvs_opt.is_some() ||
30273038
total_msat.is_some()

0 commit comments

Comments
 (0)