diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index 3a4fd4ff9..3c09701ab 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -27,7 +27,7 @@ use crate::offers::invoice_request::InvoiceRequest; use crate::offers::nonce::Nonce; use crate::offers::static_invoice::StaticInvoice; use crate::rgb_utils::{ - filter_first_hops, get_rgb_payment_info_path, is_payment_rgb, parse_rgb_payment_info, + filter_first_hops, get_rgb_payment_info_path, is_payment_rgb_out, parse_rgb_payment_info, }; use crate::routing::router::{ BlindedTail, InFlightHtlcs, Path, PaymentParameters, Route, RouteParameters, @@ -1049,7 +1049,7 @@ impl OutboundPayments { } let mut filtered_first_hops = first_hops.into_iter().collect::>(); - let rgb_payment = is_payment_rgb(&self.ldk_data_dir, &payment_hash).then(|| { + let rgb_payment = is_payment_rgb_out(&self.ldk_data_dir, &payment_hash).then(|| { filter_first_hops(&self.ldk_data_dir, &payment_hash, &mut filtered_first_hops) }); let mut route_params = RouteParameters::from_payment_params_and_value( @@ -1569,7 +1569,7 @@ impl OutboundPayments { SP: Fn(SendAlongPathArgs) -> Result<(), APIError>, { let mut filtered_first_hops = first_hops.into_iter().collect::>(); - is_payment_rgb(&self.ldk_data_dir, &payment_hash).then(|| { + is_payment_rgb_out(&self.ldk_data_dir, &payment_hash).then(|| { filter_first_hops(&self.ldk_data_dir, &payment_hash, &mut filtered_first_hops) }); let route = self.find_initial_route( @@ -1626,7 +1626,7 @@ impl OutboundPayments { } let mut filtered_first_hops = first_hops.into_iter().collect::>(); - is_payment_rgb(&self.ldk_data_dir, &payment_hash).then(|| { + is_payment_rgb_out(&self.ldk_data_dir, &payment_hash).then(|| { filter_first_hops(&self.ldk_data_dir, &payment_hash, &mut filtered_first_hops) }); diff --git a/lightning/src/rgb_utils/mod.rs b/lightning/src/rgb_utils/mod.rs index 922550885..83aefa4ad 100644 --- a/lightning/src/rgb_utils/mod.rs +++ b/lightning/src/rgb_utils/mod.rs @@ -742,10 +742,9 @@ pub(crate) fn update_rgb_channel_amount_pending( ) } -/// Whether the payment is colored -pub(crate) fn is_payment_rgb(ldk_data_dir: &Path, payment_hash: &PaymentHash) -> bool { +/// Whether the outbound payment is colored. +pub(crate) fn is_payment_rgb_out(ldk_data_dir: &Path, payment_hash: &PaymentHash) -> bool { get_rgb_payment_info_path(payment_hash, ldk_data_dir, false).exists() - || get_rgb_payment_info_path(payment_hash, ldk_data_dir, true).exists() } /// Detect the contract ID of the payment and then filter hops based on contract ID and amount