]> 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, 24 Oct 2023 04:16:34 +0000 (04:16 +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/ln/peer_handler.rs
lightning/src/onion_message/messenger.rs
lightning/src/onion_message/mod.rs

index fcc8dc3cad2a8d60c36ac836acd63254e7814ff2..26f67c37748fae86a8b4193a177192212bd183dd 100644 (file)
@@ -14,7 +14,9 @@ use lightning::offers::invoice_request::UnsignedInvoiceRequest;
 use lightning::util::test_channel_signer::TestChannelSigner;
 use lightning::util::logger::Logger;
 use lightning::util::ser::{Readable, Writeable, Writer};
-use lightning::onion_message::{CustomOnionMessageHandler, Destination, MessageRouter, OffersMessage, OffersMessageHandler, OnionMessageContents, OnionMessagePath, OnionMessenger, PendingOnionMessage};
+use lightning::onion_message::messenger::{CustomOnionMessageHandler, MessageRouter, OnionMessenger, Destination, OnionMessagePath};
+use lightning::onion_message::offers::{OffersMessage, OffersMessageHandler};
+use lightning::onion_message::packet::CustomOnionMessageContents;
 
 use crate::utils::test_logger;
 
index 5a61be7990e2a17270b7c61deeb8944952255735..a4831ded2960f0ed5e3fffecf03f57bd1d38247b 100644 (file)
@@ -78,10 +78,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 ba3a733d225db072f70cc4d185ce4e4cfe1030e9..f9c5b64ea436ad3b78faf52436294b45598b12c2 100644 (file)
@@ -32,7 +32,8 @@ use crate::ln::wire;
 use crate::ln::wire::{Encode, Type};
 #[cfg(not(c_bindings))]
 use crate::onion_message::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
-use crate::onion_message::{CustomOnionMessageHandler, OffersMessage, OffersMessageHandler, OnionMessageContents, PendingOnionMessage};
+use crate::onion_message::packet::OnionMessageContents;
+use crate::onion_message::{CustomOnionMessageHandler, OffersMessage, OffersMessageHandler, PendingOnionMessage};
 use crate::routing::gossip::{NetworkGraph, P2PGossipSync, NodeId, NodeAlias};
 use crate::util::atomic_counter::AtomicCounter;
 use crate::util::logger::Logger;
index cf0f9e086b5c41a12c2e9b1b5e27f3a03949fae7..0bd7b0f511ff5461048bd4dd656c700cbc2fb795 100644 (file)
@@ -25,7 +25,7 @@ use crate::ln::features::{InitFeatures, NodeFeatures};
 use crate::ln::msgs::{self, OnionMessage, OnionMessageHandler};
 use crate::ln::onion_utils;
 use crate::ln::peer_handler::IgnoringMessageHandler;
-pub use super::packet::OnionMessageContents;
+pub(crate) use super::packet::OnionMessageContents;
 use super::packet::ParsedOnionMessageContents;
 use super::offers::OffersMessageHandler;
 use super::packet::{BIG_PACKET_HOP_DATA_LEN, ForwardControlTlvs, Packet, Payload, ReceiveControlTlvs, SMALL_PACKET_HOP_DATA_LEN};
@@ -63,7 +63,8 @@ use crate::prelude::*;
 /// # use lightning::blinded_path::BlindedPath;
 /// # use lightning::sign::KeysManager;
 /// # use lightning::ln::peer_handler::IgnoringMessageHandler;
-/// # use lightning::onion_message::{OnionMessageContents, Destination, MessageRouter, OnionMessagePath, OnionMessenger};
+/// # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath};
+/// # use lightning::onion_message::packet::OnionMessageContents;
 /// # use lightning::util::logger::{Logger, Record};
 /// # use lightning::util::ser::{Writeable, Writer};
 /// # use lightning::io;
index ff6e0cd8e5d59a44324838a9156bce79ae0ea45e..d1e8042f0728e51390e7975c5ea4f068d9f38b69 100644 (file)
 //! [offers]: <https://github.com/lightning/bolts/pull/798>
 //! [blinded paths]: crate::blinded_path::BlindedPath
 
-mod messenger;
-mod offers;
-mod packet;
+pub mod messenger;
+pub mod offers;
+pub mod packet;
 #[cfg(test)]
 mod functional_tests;
 
 // Re-export structs so they can be imported with just the `onion_message::` module prefix.
-pub use self::messenger::{CustomOnionMessageHandler, DefaultMessageRouter, Destination, MessageRouter, OnionMessageContents, OnionMessagePath, OnionMessenger, PeeledOnion, PendingOnionMessage, SendError};
+pub(crate) use self::messenger::{CustomOnionMessageHandler, DefaultMessageRouter, Destination, MessageRouter, OnionMessageContents, OnionMessagePath, OnionMessenger, PeeledOnion, PendingOnionMessage, SendError};
 #[cfg(not(c_bindings))]
 pub use self::messenger::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
-pub use self::offers::{OffersMessage, OffersMessageHandler};
-pub use self::packet::{Packet, ParsedOnionMessageContents};
+pub(crate) use self::offers::{OffersMessage, OffersMessageHandler};
+pub(crate) use self::packet::{Packet, ParsedOnionMessageContents};
 pub(crate) use self::packet::ControlTlvs;
 pub(crate) use self::messenger::new_pending_onion_message;