From: Matt Corallo Date: Tue, 28 Feb 2023 21:45:14 +0000 (+0000) Subject: Export `outbound_payment` structs in their respective modules X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=cb8cd4e2f143cab4d4bd44d9281bd2ad2718cbbe;p=rust-lightning 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. --- diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 89ff07fe6..f44218a44 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -41,7 +41,8 @@ use lightning::sign::{KeyMaterial, InMemorySigner, Recipient, EntropySource, Nod use lightning::events; use lightning::events::MessageSendEventsProvider; use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret}; -use lightning::ln::channelmanager::{ChainParameters, ChannelDetails, ChannelManager, PaymentSendFailure, ChannelManagerReadArgs, PaymentId, RecipientOnionFields}; +use lightning::ln::channelmanager::{ChainParameters, ChannelDetails, ChannelManager, ChannelManagerReadArgs, PaymentId}; +use lightning::ln::outbound_payment::{RecipientOnionFields, PaymentSendFailure}; use lightning::ln::channel::FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE; use lightning::ln::msgs::{self, CommitmentUpdate, ChannelMessageHandler, DecodeError, UpdateAddHTLC, Init}; use lightning::ln::script::ShutdownScript; diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 1f5ceb212..2dd8e9440 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -38,7 +38,8 @@ use lightning::chain::transaction::OutPoint; use lightning::sign::{InMemorySigner, Recipient, KeyMaterial, EntropySource, NodeSigner, SignerProvider}; use lightning::events::Event; use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; -use lightning::ln::channelmanager::{ChainParameters, ChannelDetails, ChannelManager, PaymentId, RecipientOnionFields, Retry}; +use lightning::ln::channelmanager::{ChainParameters, ChannelDetails, ChannelManager, PaymentId}; +use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; use lightning::ln::peer_handler::{MessageHandler,PeerManager,SocketDescriptor,IgnoringMessageHandler}; use lightning::ln::msgs::{self, DecodeError}; use lightning::ln::script::ShutdownScript; diff --git a/lightning-invoice/src/payment.rs b/lightning-invoice/src/payment.rs index 8196fa9eb..152b9d348 100644 --- a/lightning-invoice/src/payment.rs +++ b/lightning-invoice/src/payment.rs @@ -13,7 +13,7 @@ use crate::Bolt11Invoice; use bitcoin::hashes::Hash; use lightning::ln::PaymentHash; -use lightning::ln::channelmanager::RecipientOnionFields; +use lightning::ln::outbound_payment::RecipientOnionFields; use lightning::routing::router::{PaymentParameters, RouteParameters}; /// Builds the necessary parameters to pay or pre-flight probe the given zero-amount @@ -170,7 +170,8 @@ mod tests { #[cfg(feature = "std")] fn payment_metadata_end_to_end() { use lightning::events::Event; - use lightning::ln::channelmanager::{Retry, PaymentId}; + use lightning::ln::channelmanager::PaymentId; + use lightning::ln::outbound_payment::Retry; use lightning::ln::msgs::ChannelMessageHandler; use lightning::ln::functional_test_utils::*; // Test that a payment metadata read from an invoice passed to `pay_invoice` makes it all diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index 5e8b72467..bfd3bb019 100644 --- a/lightning-invoice/src/utils.rs +++ b/lightning-invoice/src/utils.rs @@ -825,7 +825,8 @@ mod test { use lightning::ln::PaymentHash; #[cfg(feature = "std")] use lightning::ln::PaymentPreimage; - use lightning::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId, RecipientOnionFields, Retry}; + use lightning::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId}; + use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; use lightning::ln::functional_test_utils::*; use lightning::ln::msgs::ChannelMessageHandler; use lightning::routing::router::{PaymentParameters, RouteParameters}; diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 0f881637f..de1145cc7 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -95,7 +95,7 @@ use core::time::Duration; use core::ops::Deref; // Re-export this for use in the public API. -pub use crate::ln::outbound_payment::{PaymentSendFailure, ProbeSendFailure, Retry, RetryableSendFailure, RecipientOnionFields}; +pub(crate) use crate::ln::outbound_payment::{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/mod.rs b/lightning/src/ln/mod.rs index 43ec34eaf..5692f23e0 100644 --- a/lightning/src/ln/mod.rs +++ b/lightning/src/ln/mod.rs @@ -38,7 +38,7 @@ pub(crate) mod channel; pub use channel_id::ChannelId; pub(crate) mod onion_utils; -mod outbound_payment; +pub mod outbound_payment; pub mod wire; pub use onion_utils::create_payment_onion;