]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Export Onion Message structs in their respective modules 2022-09-111-bindings-and-backports
authorMatt Corallo <git@bluematt.me>
Sun, 11 Sep 2022 18:38:02 +0000 (18:38 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 23 Sep 2022 08:17:40 +0000 (08:17 +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/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/onion_message/functional_tests.rs
lightning/src/onion_message/messenger.rs
lightning/src/onion_message/mod.rs

index a2fe88afc83d6af97896dbf06bb3326d0f66e659..74bb4f71068fd68f13e827d4c800eedc6a2ee380 100644 (file)
@@ -11,7 +11,7 @@ use lightning::ln::script::ShutdownScript;
 use lightning::util::enforcing_trait_impls::EnforcingSigner;
 use lightning::util::logger::Logger;
 use lightning::util::ser::{Readable, Writer};
-use lightning::onion_message::OnionMessenger;
+use lightning::onion_message::messenger::OnionMessenger;
 
 use utils::test_logger;
 
index 747107c08221c41b04a5283a91804031d981325f..08ad3afcf498aee5b93612f0aa8093e2c8902083 100644 (file)
@@ -311,7 +311,7 @@ pub struct UpdateAddHTLC {
 pub struct OnionMessage {
        /// Used in decrypting the onion packet's payload.
        pub blinding_point: PublicKey,
-       pub(crate) onion_routing_packet: onion_message::Packet,
+       pub(crate) onion_routing_packet: onion_message::packet::Packet,
 }
 
 /// An update_fulfill_htlc message to be sent or received from a peer
@@ -1404,7 +1404,7 @@ impl Readable for OnionMessage {
                let blinding_point: PublicKey = Readable::read(r)?;
                let len: u16 = Readable::read(r)?;
                let mut packet_reader = FixedLengthReader::new(r, len as u64);
-               let onion_routing_packet: onion_message::Packet = <onion_message::Packet as LengthReadable>::read(&mut packet_reader)?;
+               let onion_routing_packet = <onion_message::packet::Packet as LengthReadable>::read(&mut packet_reader)?;
                Ok(Self {
                        blinding_point,
                        onion_routing_packet,
index 6712abeb109c59b60c687f8ecf38c150eb8d76dd..2a40a99db2174f464cc3379b9d2f90293fdf91a7 100644 (file)
@@ -25,7 +25,7 @@ use util::ser::{VecWriter, Writeable, Writer};
 use ln::peer_channel_encryptor::{PeerChannelEncryptor,NextNoiseStep};
 use ln::wire;
 use ln::wire::Encode;
-use onion_message::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
+use onion_message::messenger::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
 use routing::gossip::{NetworkGraph, P2PGossipSync};
 use util::atomic_counter::AtomicCounter;
 use util::crypto::sign;
index 9b4d2a549240cada5cc998f682a604eb864617e6..4545cc8b56b0bd1dbde5ddf1b525f9ed88568302 100644 (file)
@@ -12,7 +12,8 @@
 use chain::keysinterface::{KeysInterface, Recipient};
 use ln::features::InitFeatures;
 use ln::msgs::{self, OnionMessageHandler};
-use super::{BlindedRoute, Destination, OnionMessenger, SendError};
+use super::blinded_route::BlindedRoute;
+use super::messenger::{Destination, OnionMessenger, SendError};
 use util::enforcing_trait_impls::EnforcingSigner;
 use util::test_utils;
 
index 729fa813dea009d5fb043e9dca74058b918dc2ec..62c01e9868ae634ffa8e59e785f7a5ee0065a331 100644 (file)
@@ -41,7 +41,8 @@ use prelude::*;
 /// # use bitcoin::hashes::_export::_core::time::Duration;
 /// # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
 /// # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
-/// # use lightning::onion_message::{BlindedRoute, Destination, OnionMessenger};
+/// # use lightning::onion_message::messenger::{Destination, OnionMessenger};
+/// # use lightning::onion_message::blinded_route::BlindedRoute;
 /// # use lightning::util::logger::{Logger, Record};
 /// # use std::sync::Arc;
 /// # struct FakeLogger {};
index 2e23b76ada33ac8f1a7355943edb8d5c9ee25392..1830d3ba7376bb01bbe0f8f0c2e17900e2d64e6a 100644 (file)
 //! information on its usage.
 //!
 //! [offers]: <https://github.com/lightning/bolts/pull/798>
-//! [blinded routes]: crate::onion_message::BlindedRoute
+//! [blinded routes]: crate::onion_message::blinded_route::BlindedRoute
+//! [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
 
-mod blinded_route;
-mod messenger;
-mod packet;
+pub mod blinded_route;
+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_route::{BlindedRoute, BlindedHop};
-pub use self::messenger::{Destination, OnionMessenger, SendError, SimpleArcOnionMessenger, SimpleRefOnionMessenger};
-pub(crate) use self::packet::Packet;