From 212e4a5ab6069563ef5d31555d1e2f478fe8af6f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 22 Aug 2024 21:09:33 +0000 Subject: [PATCH] Export `outbound_payment` structs in their respective modules Re-exports in Rust make `use` statements a little shorter, but for otherwise don't materially change a crate's API. Sadly, the C bindings generator currently can't figure out re-exports, but it also exports everything into one global namespace, so it doesn't matter much anyway. --- fuzz/src/chanmon_consistency.rs | 4 ++-- fuzz/src/full_stack.rs | 3 ++- lightning/src/ln/bolt11_payment.rs | 5 +++-- lightning/src/ln/channelmanager.rs | 2 +- lightning/src/ln/invoice_utils.rs | 3 ++- lightning/src/ln/mod.rs | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 8929a579c..98935c49b 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -47,9 +47,9 @@ use lightning::events::MessageSendEventsProvider; use lightning::ln::channel::FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE; use lightning::ln::channel_state::ChannelDetails; use lightning::ln::channelmanager::{ - ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId, PaymentSendFailure, - RecipientOnionFields, + ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId, }; +use lightning::ln::outbound_payment::{RecipientOnionFields, PaymentSendFailure}; use lightning::ln::functional_test_utils::*; use lightning::ln::msgs::{ self, ChannelMessageHandler, CommitmentUpdate, DecodeError, Init, UpdateAddHTLC, diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 90449248e..bb193cac2 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -40,8 +40,9 @@ use lightning::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Listen}; use lightning::events::Event; use lightning::ln::channel_state::ChannelDetails; use lightning::ln::channelmanager::{ - ChainParameters, ChannelManager, InterceptId, PaymentId, RecipientOnionFields, Retry, + ChainParameters, ChannelManager, InterceptId, PaymentId, }; +use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; use lightning::ln::functional_test_utils::*; use lightning::ln::msgs::{self, DecodeError}; use lightning::ln::peer_handler::{ diff --git a/lightning/src/ln/bolt11_payment.rs b/lightning/src/ln/bolt11_payment.rs index d0655968a..30d03f9f2 100644 --- a/lightning/src/ln/bolt11_payment.rs +++ b/lightning/src/ln/bolt11_payment.rs @@ -12,7 +12,7 @@ use bitcoin::hashes::Hash; use lightning_invoice::Bolt11Invoice; -use crate::ln::channelmanager::RecipientOnionFields; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::PaymentHash; use crate::routing::router::{PaymentParameters, RouteParameters}; @@ -161,7 +161,8 @@ mod tests { #[test] fn payment_metadata_end_to_end() { use crate::events::Event; - use crate::ln::channelmanager::{PaymentId, Retry}; + use crate::ln::channelmanager::PaymentId; + use crate::ln::outbound_payment::Retry; use crate::ln::functional_test_utils::*; use crate::ln::msgs::ChannelMessageHandler; diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index b3047930f..09fc1e460 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -111,7 +111,7 @@ use core::time::Duration; use core::ops::Deref; // Re-export this for use in the public API. -pub use crate::ln::outbound_payment::{Bolt12PaymentError, PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields}; +pub(crate) use crate::ln::outbound_payment::{Bolt12PaymentError, PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields}; use crate::ln::script::ShutdownScript; // We hold various information about HTLC relay in the HTLC objects in Channel itself: diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs index 71686df59..79c6c96ca 100644 --- a/lightning/src/ln/invoice_utils.rs +++ b/lightning/src/ln/invoice_utils.rs @@ -825,7 +825,8 @@ mod test { use crate::events::{MessageSendEvent, MessageSendEventsProvider}; use crate::ln::types::PaymentHash; use crate::ln::types::PaymentPreimage; - use crate::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId, RecipientOnionFields, Retry}; + use crate::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId}; + use crate::ln::outbound_payment::{RecipientOnionFields, Retry}; use crate::ln::functional_test_utils::*; use crate::ln::msgs::ChannelMessageHandler; use crate::routing::router::{PaymentParameters, RouteParameters}; diff --git a/lightning/src/ln/mod.rs b/lightning/src/ln/mod.rs index dceb52ab4..1a229159e 100644 --- a/lightning/src/ln/mod.rs +++ b/lightning/src/ln/mod.rs @@ -49,7 +49,7 @@ pub mod channel; pub(crate) mod channel; pub(crate) mod onion_utils; -mod outbound_payment; +pub mod outbound_payment; pub mod wire; pub use onion_utils::create_payment_onion; -- 2.39.5