@@ -57,7 +57,7 @@ use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelType
57
57
use crate::types::features::Bolt11InvoiceFeatures;
58
58
use crate::routing::gossip::NodeId;
59
59
use crate::routing::router::{BlindedTail, FixedRouter, InFlightHtlcs, Path, Payee, PaymentParameters, Route, RouteParameters, Router};
60
- 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};
60
+ 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 };
61
61
use crate::ln::msgs;
62
62
use crate::ln::onion_utils;
63
63
use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING};
@@ -4261,11 +4261,15 @@ where
4261
4261
// we don't allow forwards outbound over them.
4262
4262
return Err(("Refusing to forward to a private channel based on our config.", 0x4000 | 10));
4263
4263
}
4264
- if chan.context.get_channel_type().supports_scid_privacy() && next_packet.outgoing_scid != chan.context.outbound_scid_alias() {
4265
- // `option_scid_alias` (referred to in LDK as `scid_privacy`) means
4266
- // "refuse to forward unless the SCID alias was used", so we pretend
4267
- // we don't have the channel here.
4268
- return Err(("Refusing to forward over real channel SCID as our counterparty requested.", 0x4000 | 10));
4264
+ if let HopConnector::ShortChannelId(outgoing_scid) = next_packet.outgoing_connector {
4265
+ if chan.context.get_channel_type().supports_scid_privacy() && outgoing_scid != chan.context.outbound_scid_alias() {
4266
+ // `option_scid_alias` (referred to in LDK as `scid_privacy`) means
4267
+ // "refuse to forward unless the SCID alias was used", so we pretend
4268
+ // we don't have the channel here.
4269
+ return Err(("Refusing to forward over real channel SCID as our counterparty requested.", 0x4000 | 10));
4270
+ }
4271
+ } else {
4272
+ return Err(("Cannot forward by Node ID without SCID.", 0x4000 | 10));
4269
4273
}
4270
4274
4271
4275
// Note that we could technically not return an error yet here and just hope
@@ -4317,7 +4321,13 @@ where
4317
4321
fn can_forward_htlc(
4318
4322
&self, msg: &msgs::UpdateAddHTLC, next_packet_details: &NextPacketDetails
4319
4323
) -> Result<(), (&'static str, u16)> {
4320
- match self.do_funded_channel_callback(next_packet_details.outgoing_scid, |chan: &mut FundedChannel<SP>| {
4324
+ let outgoing_scid = match next_packet_details.outgoing_connector {
4325
+ HopConnector::ShortChannelId(scid) => scid,
4326
+ HopConnector::Trampoline { .. } => {
4327
+ return Err(("Cannot forward by Node ID without SCID.", 0x4000 | 10));
4328
+ }
4329
+ };
4330
+ match self.do_funded_channel_callback(outgoing_scid, |chan: &mut FundedChannel<SP>| {
4321
4331
self.can_forward_htlc_to_outgoing_channel(chan, msg, next_packet_details)
4322
4332
}) {
4323
4333
Some(Ok(())) => {},
@@ -4326,8 +4336,8 @@ where
4326
4336
// If we couldn't find the channel info for the scid, it may be a phantom or
4327
4337
// intercept forward.
4328
4338
if (self.default_configuration.accept_intercept_htlcs &&
4329
- fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, next_packet_details. outgoing_scid, &self.chain_hash)) ||
4330
- fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, next_packet_details. outgoing_scid, &self.chain_hash)
4339
+ fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, outgoing_scid, &self.chain_hash)) ||
4340
+ fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, outgoing_scid, &self.chain_hash)
4331
4341
{} else {
4332
4342
return Err(("Don't have available channel for forwarding as requested.", 0x4000 | 10));
4333
4343
}
@@ -5679,7 +5689,12 @@ where
5679
5689
};
5680
5690
5681
5691
let is_intro_node_blinded_forward = next_hop.is_intro_node_blinded_forward();
5682
- let outgoing_scid_opt = next_packet_details_opt.as_ref().map(|d| d.outgoing_scid);
5692
+ let outgoing_scid_opt = next_packet_details_opt.as_ref().and_then(|d| {
5693
+ match d.outgoing_connector {
5694
+ HopConnector::ShortChannelId(scid) => { Some(scid) }
5695
+ HopConnector::Trampoline { .. } => { None }
5696
+ }
5697
+ });
5683
5698
5684
5699
// Process the HTLC on the incoming channel.
5685
5700
match self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
0 commit comments