Skip to content

Commit c4404a8

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 9e4a35a commit c4404a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning/src/ln/channelmanager.rs

+6-2
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,
@@ -2680,6 +2681,7 @@ where
26802681
routing: PendingHTLCRouting::Forward {
26812682
onion_packet: outgoing_packet,
26822683
short_channel_id,
2684+
incoming_cltv_expiry: Some(msg.cltv_expiry),
26832685
},
26842686
payment_hash: msg.payment_hash,
26852687
incoming_shared_secret: shared_secret,
@@ -3706,8 +3708,9 @@ where
37063708
})?;
37073709

37083710
let routing = match payment.forward_info.routing {
3709-
PendingHTLCRouting::Forward { onion_packet, .. } => {
3710-
PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid }
3711+
PendingHTLCRouting::Forward { onion_packet, incoming_cltv_expiry, .. } => {
3712+
PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid,
3713+
incoming_cltv_expiry }
37113714
},
37123715
_ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
37133716
};
@@ -7701,6 +7704,7 @@ impl_writeable_tlv_based!(PhantomRouteHints, {
77017704
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
77027705
(0, Forward) => {
77037706
(0, onion_packet, required),
7707+
(1, incoming_cltv_expiry, option),
77047708
(2, short_channel_id, required),
77057709
},
77067710
(1, Receive) => {

0 commit comments

Comments
 (0)