]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Export Onion Message structs in their respective modules
authorMatt Corallo <git@bluematt.me>
Mon, 19 Dec 2022 21:38:45 +0000 (21:38 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 3 Jan 2023 22:09:15 +0000 (22:09 +0000)
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/onion_message.rs
lightning-rapid-gossip-sync/src/lib.rs
lightning/src/onion_message/messenger.rs
lightning/src/onion_message/mod.rs

index b1f8fc33637f948cc0a6cf1c8b30ccfeaa45a0a1..0e0ea25b415cfbffc9857934c052c99871b3d0b8 100644 (file)
@@ -11,7 +11,8 @@ use lightning::ln::script::ShutdownScript;
 use lightning::util::enforcing_trait_impls::EnforcingSigner;
 use lightning::util::logger::Logger;
 use lightning::util::ser::{Readable, Writeable, Writer};
-use lightning::onion_message::{CustomOnionMessageContents, CustomOnionMessageHandler, OnionMessenger};
+use lightning::onion_message::packet::CustomOnionMessageContents;
+use lightning::onion_message::messenger::{OnionMessenger, CustomOnionMessageHandler};
 
 use crate::utils::test_logger;
 
index 06ce7eb2075574df38c2b9cbf44813235e1fba1c..b347f69c1feea67f430359c4d0db89da716991a1 100644 (file)
@@ -79,10 +79,10 @@ use lightning::io;
 use lightning::routing::gossip::NetworkGraph;
 use lightning::util::logger::Logger;
 
-pub use crate::error::GraphSyncError;
+use crate::error::GraphSyncError;
 
 /// Error types that these functions can return
-mod error;
+pub mod error;
 
 /// Core functionality of this crate
 mod processing;
index 269b5f8cb7cfd96c55a59375ca8d6218712ba823..3ee9d8fc4fabe81b9438367ac96bfcd903c97638 100644 (file)
@@ -21,7 +21,7 @@ use crate::ln::msgs::{self, OnionMessageHandler};
 use crate::ln::onion_utils;
 use crate::ln::peer_handler::IgnoringMessageHandler;
 use super::blinded_path::{BlindedPath, ForwardTlvs, ReceiveTlvs};
-pub use super::packet::{CustomOnionMessageContents, OnionMessageContents};
+use super::packet::{CustomOnionMessageContents, OnionMessageContents};
 use super::packet::{BIG_PACKET_HOP_DATA_LEN, ForwardControlTlvs, Packet, Payload, ReceiveControlTlvs, SMALL_PACKET_HOP_DATA_LEN};
 use super::utils;
 use crate::util::events::OnionMessageProvider;
@@ -46,7 +46,8 @@ use crate::prelude::*;
 /// # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
 /// # use lightning::ln::msgs::DecodeError;
 /// # use lightning::ln::peer_handler::IgnoringMessageHandler;
-/// # use lightning::onion_message::{BlindedPath, CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger};
+/// # use lightning::onion_message::blinded_path::BlindedPath;
+/// # use lightning::onion_message::messenger::{CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger};
 /// # use lightning::util::logger::{Logger, Record};
 /// # use lightning::util::ser::{Writeable, Writer};
 /// # use lightning::io;
index e735b428ea03dea6a26018bf23ac8ff4670e7c33..7a2ee12d0466fe958c771bd52ab95dabf55e7332 100644 (file)
 //! [offers]: <https://github.com/lightning/bolts/pull/798>
 //! [blinded paths]: crate::onion_message::BlindedPath
 
-mod blinded_path;
-mod messenger;
-mod packet;
+pub mod blinded_path;
+pub mod messenger;
+pub mod packet;
 mod utils;
 #[cfg(test)]
 mod functional_tests;
 
-// Re-export structs so they can be imported with just the `onion_message::` module prefix.
-pub use self::blinded_path::{BlindedPath, BlindedHop};
-pub use self::messenger::{CustomOnionMessageContents, CustomOnionMessageHandler, Destination, OnionMessageContents, OnionMessenger, SendError, SimpleArcOnionMessenger, SimpleRefOnionMessenger};
-pub(crate) use self::packet::Packet;
+
+pub(crate) use self::blinded_path::{BlindedPath, BlindedHop};
+pub(crate) use self::messenger::{CustomOnionMessageHandler, Destination, OnionMessenger, SendError, SimpleArcOnionMessenger, SimpleRefOnionMessenger};
+pub(crate) use self::packet::{Packet, CustomOnionMessageContents, OnionMessageContents};