Skip to content

Commit ace46b4

Browse files
committed
Add cltv expiry to PendingHTLCRouting::Forward
This is needed to add cltv expiry to HTLCSource::PreviousHopData in an upcoming commit.
1 parent c383f06 commit ace46b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub(super) enum PendingHTLCRouting {
104104
/// The SCID from the onion that we should forward to. This could be a real SCID or a fake one
105105
/// generated using `get_fake_scid` from the scid_utils::fake_scid module.
106106
short_channel_id: u64, // This should be NonZero<u64> eventually when we bump MSRV
107+
incoming_cltv_expiry: Option<u32>,
107108
},
108109
Receive {
109110
payment_data: msgs::FinalOnionHopData,
@@ -3002,6 +3003,7 @@ where
30023003
routing: PendingHTLCRouting::Forward {
30033004
onion_packet: outgoing_packet,
30043005
short_channel_id,
3006+
incoming_cltv_expiry: Some(msg.cltv_expiry),
30053007
},
30063008
payment_hash: msg.payment_hash.clone(),
30073009
incoming_shared_secret: shared_secret,
@@ -3669,8 +3671,9 @@ where
36693671
})?;
36703672

36713673
let routing = match payment.forward_info.routing {
3672-
PendingHTLCRouting::Forward { onion_packet, .. } => {
3673-
PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid }
3674+
PendingHTLCRouting::Forward { onion_packet, incoming_cltv_expiry, .. } => {
3675+
PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid,
3676+
incoming_cltv_expiry }
36743677
},
36753678
_ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
36763679
};
@@ -7615,6 +7618,7 @@ impl_writeable_tlv_based!(PhantomRouteHints, {
76157618
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
76167619
(0, Forward) => {
76177620
(0, onion_packet, required),
7621+
(1, incoming_cltv_expiry, option),
76187622
(2, short_channel_id, required),
76197623
},
76207624
(1, Receive) => {

0 commit comments

Comments
 (0)