@@ -56,7 +56,7 @@ use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelType
5656#[cfg(any(feature = "_test_utils", test))]
5757use crate::types::features::Bolt11InvoiceFeatures;
5858use crate::routing::router::{BlindedTail, FixedRouter, InFlightHtlcs, Path, Payee, PaymentParameters, Route, RouteParameters, Router};
59- use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, InboundHTLCErr, NextPacketDetails};
59+ use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, InboundHTLCErr, NextPacketDetails, HopConnector };
6060use crate::ln::msgs;
6161use crate::ln::onion_utils;
6262use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING};
@@ -4240,11 +4240,15 @@ where
42404240 // we don't allow forwards outbound over them.
42414241 return Err(("Refusing to forward to a private channel based on our config.", 0x4000 | 10));
42424242 }
4243- if chan.context.get_channel_type().supports_scid_privacy() && next_packet.outgoing_scid != chan.context.outbound_scid_alias() {
4244- // `option_scid_alias` (referred to in LDK as `scid_privacy`) means
4245- // "refuse to forward unless the SCID alias was used", so we pretend
4246- // we don't have the channel here.
4247- return Err(("Refusing to forward over real channel SCID as our counterparty requested.", 0x4000 | 10));
4243+ if let HopConnector::ShortChannelId(outgoing_scid) = next_packet.outgoing_connector {
4244+ if chan.context.get_channel_type().supports_scid_privacy() && outgoing_scid != chan.context.outbound_scid_alias() {
4245+ // `option_scid_alias` (referred to in LDK as `scid_privacy`) means
4246+ // "refuse to forward unless the SCID alias was used", so we pretend
4247+ // we don't have the channel here.
4248+ return Err(("Refusing to forward over real channel SCID as our counterparty requested.", 0x4000 | 10));
4249+ }
4250+ } else {
4251+ return Err(("Cannot forward by Node ID without SCID.", 0x4000 | 10));
42484252 }
42494253
42504254 // Note that we could technically not return an error yet here and just hope
@@ -4296,7 +4300,13 @@ where
42964300 fn can_forward_htlc(
42974301 &self, msg: &msgs::UpdateAddHTLC, next_packet_details: &NextPacketDetails
42984302 ) -> Result<(), (&'static str, u16)> {
4299- match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut FundedChannel<SP>| {
4303+ let outgoing_scid = match next_packet_details.outgoing_connector {
4304+ HopConnector::ShortChannelId(scid) => scid,
4305+ HopConnector::NodeId(_) => {
4306+ return Err(("Cannot forward by Node ID without SCID.", 0x4000 | 10));
4307+ }
4308+ };
4309+ match self.do_funded_channel_callback(outgoing_scid, |chan: &mut FundedChannel<SP>| {
43004310 self.can_forward_htlc_to_outgoing_channel(chan, msg, next_packet_details)
43014311 }) {
43024312 Some(Ok(())) => {},
@@ -4305,8 +4315,8 @@ where
43054315 // If we couldn't find the channel info for the scid, it may be a phantom or
43064316 // intercept forward.
43074317 if (self.default_configuration.accept_intercept_htlcs &&
4308- fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, next_packet_details. outgoing_scid, &self.chain_hash)) ||
4309- fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, next_packet_details. outgoing_scid, &self.chain_hash)
4318+ fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, outgoing_scid, &self.chain_hash)) ||
4319+ fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, outgoing_scid, &self.chain_hash)
43104320 {} else {
43114321 return Err(("Don't have available channel for forwarding as requested.", 0x4000 | 10));
43124322 }
@@ -5647,7 +5657,12 @@ where
56475657 };
56485658
56495659 let is_intro_node_blinded_forward = next_hop.is_intro_node_blinded_forward();
5650- let outgoing_scid_opt = next_packet_details_opt.as_ref().map(|d| d.outgoing_scid);
5660+ let outgoing_scid_opt = next_packet_details_opt.as_ref().and_then(|d| {
5661+ match d.outgoing_connector {
5662+ HopConnector::ShortChannelId(scid) => { Some(scid) }
5663+ HopConnector::NodeId(_) => { None }
5664+ }
5665+ });
56515666
56525667 // Process the HTLC on the incoming channel.
56535668 match self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
0 commit comments