@@ -1250,28 +1250,29 @@ pub enum Event {
12501250 short_channel_id : Option < u64 > ,
12511251 } ,
12521252 /// Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
1253- /// you've encoded an intercept scid in the receiver's invoice route hints using
1254- /// [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
1253+ /// you've set some flags on [`UserConfig::htlc_interception_flags`].
12551254 ///
12561255 /// [`ChannelManager::forward_intercepted_htlc`] or
1257- /// [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
1258- /// their docs for more information.
1256+ /// [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event in a
1257+ /// timely manner (i.e. within some number of seconds, not minutes). See their docs for more
1258+ /// information.
12591259 ///
12601260 /// # Failure Behavior and Persistence
12611261 /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
12621262 /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
12631263 ///
1264- /// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
1265- /// [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
1264+ /// [`UserConfig::htlc_interception_flags`]: crate::util::config::UserConfig::htlc_interception_flags
12661265 /// [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
12671266 /// [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
12681267 HTLCIntercepted {
12691268 /// An id to help LDK identify which HTLC is being forwarded or failed.
12701269 intercept_id : InterceptId ,
1271- /// The fake scid that was programmed as the next hop's scid, generated using
1272- /// [`ChannelManager::get_intercept_scid`].
1270+ /// The SCID which was selected by the sender as the next hop. It may point to one of our
1271+ /// channels, an intercept SCID generated with [`ChannelManager::get_intercept_scid`], or
1272+ /// an unknown SCID if [`HTLCInterceptionFlags::ToUnknownSCIDs`] was selected.
12731273 ///
12741274 /// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
1275+ /// [`HTLCInterceptionFlags::ToUnknownSCIDs`]: crate::util::config::HTLCInterceptionFlags::ToUnknownSCIDs
12751276 requested_next_hop_scid : u64 ,
12761277 /// The payment hash used for this HTLC.
12771278 payment_hash : PaymentHash ,
@@ -1282,9 +1283,17 @@ pub enum Event {
12821283 /// Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
12831284 ///
12841285 /// Note that LDK will NOT check that expected fees were factored into this value. You MUST
1285- /// check that whatever fee you want has been included here or subtract it as required. Further,
1286+ /// check that whatever fee you want has been included here (by comparing with
1287+ /// [`Self::HTLCIntercepted::inbound_amount_msat`]) or subtract it as required. Further,
12861288 /// LDK will not stop you from forwarding more than you received.
12871289 expected_outbound_amount_msat : u64 ,
1290+ /// The block height at which the forwarded HTLC sent to our peer will time out. In
1291+ /// practice, LDK will refuse to forward an HTLC several blocks before this height (as if
1292+ /// we attempted to forward an HTLC at this height we'd run some risk that our peer
1293+ /// force-closes the channel immediately).
1294+ ///
1295+ /// This will only be `None` for events generated or serialized by LDK 0.2 or prior.
1296+ outgoing_htlc_expiry_block_height : Option < u32 > ,
12881297 } ,
12891298 /// Used to indicate that an output which you should know how to spend was confirmed on chain
12901299 /// and is now spendable.
@@ -2015,11 +2024,13 @@ impl Writeable for Event {
20152024 inbound_amount_msat,
20162025 expected_outbound_amount_msat,
20172026 intercept_id,
2027+ outgoing_htlc_expiry_block_height,
20182028 } => {
20192029 6u8 . write ( writer) ?;
20202030 let intercept_scid = InterceptNextHop :: FakeScid { requested_next_hop_scid } ;
20212031 write_tlv_fields ! ( writer, {
20222032 ( 0 , intercept_id, required) ,
2033+ ( 1 , outgoing_htlc_expiry_block_height, option) ,
20232034 ( 2 , intercept_scid, required) ,
20242035 ( 4 , payment_hash, required) ,
20252036 ( 6 , inbound_amount_msat, required) ,
@@ -2524,8 +2535,10 @@ impl MaybeReadable for Event {
25242535 InterceptNextHop :: FakeScid { requested_next_hop_scid : 0 } ;
25252536 let mut inbound_amount_msat = 0 ;
25262537 let mut expected_outbound_amount_msat = 0 ;
2538+ let mut outgoing_htlc_expiry_block_height = None ;
25272539 read_tlv_fields ! ( reader, {
25282540 ( 0 , intercept_id, required) ,
2541+ ( 1 , outgoing_htlc_expiry_block_height, option) ,
25292542 ( 2 , requested_next_hop_scid, required) ,
25302543 ( 4 , payment_hash, required) ,
25312544 ( 6 , inbound_amount_msat, required) ,
@@ -2540,6 +2553,7 @@ impl MaybeReadable for Event {
25402553 inbound_amount_msat,
25412554 expected_outbound_amount_msat,
25422555 intercept_id,
2556+ outgoing_htlc_expiry_block_height,
25432557 } ) )
25442558 } ,
25452559 7u8 => {
0 commit comments