Skip to content

Commit 9653354

Browse files
Move blinded_path and its utils into a new module
1 parent 3b8bf93 commit 9653354

File tree

13 files changed

+30
-30
lines changed

13 files changed

+30
-30
lines changed

fuzz/src/invoice_request_deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
use bitcoin::secp256k1::{KeyPair, Parity, PublicKey, Secp256k1, SecretKey, self};
1111
use crate::utils::test_logger;
1212
use core::convert::{Infallible, TryFrom};
13+
use lightning::blinded_path::BlindedPath;
1314
use lightning::chain::keysinterface::EntropySource;
1415
use lightning::ln::PaymentHash;
1516
use lightning::ln::features::BlindedHopFeatures;
1617
use lightning::offers::invoice::{BlindedPayInfo, UnsignedInvoice};
1718
use lightning::offers::invoice_request::InvoiceRequest;
1819
use lightning::offers::parse::SemanticError;
19-
use lightning::onion_message::BlindedPath;
2020
use lightning::util::ser::Writeable;
2121

2222
#[inline]

fuzz/src/refund_deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey, self};
1111
use crate::utils::test_logger;
1212
use core::convert::{Infallible, TryFrom};
13+
use lightning::blinded_path::BlindedPath;
1314
use lightning::chain::keysinterface::EntropySource;
1415
use lightning::ln::PaymentHash;
1516
use lightning::ln::features::BlindedHopFeatures;
1617
use lightning::offers::invoice::{BlindedPayInfo, UnsignedInvoice};
1718
use lightning::offers::parse::SemanticError;
1819
use lightning::offers::refund::Refund;
19-
use lightning::onion_message::BlindedPath;
2020
use lightning::util::ser::Writeable;
2121

2222
#[inline]

lightning/src/onion_message/blinded_path.rs renamed to lightning/src/blinded_path/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99

1010
//! Creating blinded paths and related utilities live here.
1111
12+
pub(crate) mod utils;
13+
1214
use bitcoin::hashes::{Hash, HashEngine};
1315
use bitcoin::hashes::sha256::Hash as Sha256;
1416
use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1, SecretKey};
1517

1618
use crate::chain::keysinterface::{EntropySource, NodeSigner, Recipient};
17-
use super::packet::ControlTlvs;
18-
use super::utils;
19+
use crate::onion_message::ControlTlvs;
1920
use crate::ln::msgs::DecodeError;
2021
use crate::ln::onion_utils;
2122
use crate::util::chacha20poly1305rfc::{ChaChaPolyReadAdapter, ChaChaPolyWriteAdapter};

lightning/src/onion_message/utils.rs renamed to lightning/src/blinded_path/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ use bitcoin::hashes::sha256::Hash as Sha256;
1515
use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey, Scalar};
1616
use bitcoin::secp256k1::ecdh::SharedSecret;
1717

18+
use super::BlindedPath;
1819
use crate::ln::onion_utils;
19-
use super::blinded_path::BlindedPath;
20-
use super::messenger::Destination;
20+
use crate::onion_message::Destination;
2121

2222
use crate::prelude::*;
2323

2424
// TODO: DRY with onion_utils::construct_onion_keys_callback
2525
#[inline]
26-
pub(super) fn construct_keys_callback<T: secp256k1::Signing + secp256k1::Verification,
26+
pub(crate) fn construct_keys_callback<T: secp256k1::Signing + secp256k1::Verification,
2727
FType: FnMut(PublicKey, SharedSecret, PublicKey, [u8; 32], Option<PublicKey>, Option<Vec<u8>>)>(
2828
secp_ctx: &Secp256k1<T>, unblinded_path: &[PublicKey], destination: Option<Destination>,
2929
session_priv: &SecretKey, mut callback: FType

lightning/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub mod ln;
8181
pub mod offers;
8282
pub mod routing;
8383
pub mod onion_message;
84+
pub mod blinded_path;
8485
pub mod events;
8586

8687
#[cfg(feature = "std")]

lightning/src/offers/invoice.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//!
3030
//! # use lightning::ln::PaymentHash;
3131
//! # use lightning::offers::invoice::BlindedPayInfo;
32-
//! # use lightning::onion_message::BlindedPath;
32+
//! # use lightning::blinded_path::BlindedPath;
3333
//! #
3434
//! # fn create_payment_paths() -> Vec<(BlindedPath, BlindedPayInfo)> { unimplemented!() }
3535
//! # fn create_payment_hash() -> PaymentHash { unimplemented!() }
@@ -113,7 +113,7 @@ use crate::offers::offer::{Amount, OfferTlvStream, OfferTlvStreamRef};
113113
use crate::offers::parse::{ParseError, ParsedMessage, SemanticError};
114114
use crate::offers::payer::{PayerTlvStream, PayerTlvStreamRef};
115115
use crate::offers::refund::{Refund, RefundContents};
116-
use crate::onion_message::BlindedPath;
116+
use crate::blinded_path::BlindedPath;
117117
use crate::util::ser::{HighZeroBytesDroppedBigSize, Iterable, SeekReadable, WithoutLength, Writeable, Writer};
118118

119119
use crate::prelude::*;
@@ -783,6 +783,7 @@ mod tests {
783783
use bitcoin::util::schnorr::TweakedPublicKey;
784784
use core::convert::{Infallible, TryFrom};
785785
use core::time::Duration;
786+
use crate::blinded_path::{BlindedHop, BlindedPath};
786787
use crate::ln::PaymentHash;
787788
use crate::ln::msgs::DecodeError;
788789
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
@@ -792,7 +793,6 @@ mod tests {
792793
use crate::offers::parse::{ParseError, SemanticError};
793794
use crate::offers::payer::PayerTlvStreamRef;
794795
use crate::offers::refund::RefundBuilder;
795-
use crate::onion_message::{BlindedHop, BlindedPath};
796796
use crate::util::ser::{BigSize, Iterable, Writeable};
797797

798798
fn payer_keys() -> KeyPair {

lightning/src/offers/invoice_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use bitcoin::secp256k1::{Message, PublicKey};
5858
use bitcoin::secp256k1::schnorr::Signature;
5959
use core::convert::TryFrom;
6060
use crate::io;
61+
use crate::blinded_path::BlindedPath;
6162
use crate::ln::PaymentHash;
6263
use crate::ln::features::InvoiceRequestFeatures;
6364
use crate::ln::msgs::DecodeError;
@@ -66,7 +67,6 @@ use crate::offers::merkle::{SignError, SignatureTlvStream, SignatureTlvStreamRef
6667
use crate::offers::offer::{Offer, OfferContents, OfferTlvStream, OfferTlvStreamRef};
6768
use crate::offers::parse::{ParseError, ParsedMessage, SemanticError};
6869
use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
69-
use crate::onion_message::BlindedPath;
7070
use crate::util::ser::{HighZeroBytesDroppedBigSize, SeekReadable, WithoutLength, Writeable, Writer};
7171
use crate::util::string::PrintableString;
7272

lightning/src/offers/offer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! use lightning::offers::parse::ParseError;
2828
//! use lightning::util::ser::{Readable, Writeable};
2929
//!
30-
//! # use lightning::onion_message::BlindedPath;
30+
//! # use lightning::blinded_path::BlindedPath;
3131
//! # #[cfg(feature = "std")]
3232
//! # use std::time::SystemTime;
3333
//! #
@@ -74,11 +74,11 @@ use core::num::NonZeroU64;
7474
use core::str::FromStr;
7575
use core::time::Duration;
7676
use crate::io;
77+
use crate::blinded_path::BlindedPath;
7778
use crate::ln::features::OfferFeatures;
7879
use crate::ln::msgs::MAX_VALUE_MSAT;
7980
use crate::offers::invoice_request::InvoiceRequestBuilder;
8081
use crate::offers::parse::{Bech32Encode, ParseError, ParsedMessage, SemanticError};
81-
use crate::onion_message::BlindedPath;
8282
use crate::util::ser::{HighZeroBytesDroppedBigSize, WithoutLength, Writeable, Writer};
8383
use crate::util::string::PrintableString;
8484

@@ -670,10 +670,10 @@ mod tests {
670670
use core::convert::TryFrom;
671671
use core::num::NonZeroU64;
672672
use core::time::Duration;
673+
use crate::blinded_path::{BlindedHop, BlindedPath};
673674
use crate::ln::features::OfferFeatures;
674675
use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
675676
use crate::offers::parse::{ParseError, SemanticError};
676-
use crate::onion_message::{BlindedHop, BlindedPath};
677677
use crate::util::ser::{BigSize, Writeable};
678678
use crate::util::string::PrintableString;
679679

lightning/src/offers/refund.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//! use lightning::offers::refund::{Refund, RefundBuilder};
3333
//! use lightning::util::ser::{Readable, Writeable};
3434
//!
35-
//! # use lightning::onion_message::BlindedPath;
35+
//! # use lightning::blinded_path::BlindedPath;
3636
//! # #[cfg(feature = "std")]
3737
//! # use std::time::SystemTime;
3838
//! #
@@ -78,6 +78,7 @@ use core::convert::TryFrom;
7878
use core::str::FromStr;
7979
use core::time::Duration;
8080
use crate::io;
81+
use crate::blinded_path::BlindedPath;
8182
use crate::ln::PaymentHash;
8283
use crate::ln::features::InvoiceRequestFeatures;
8384
use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
@@ -86,7 +87,6 @@ use crate::offers::invoice_request::{InvoiceRequestTlvStream, InvoiceRequestTlvS
8687
use crate::offers::offer::{OfferTlvStream, OfferTlvStreamRef};
8788
use crate::offers::parse::{Bech32Encode, ParseError, ParsedMessage, SemanticError};
8889
use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
89-
use crate::onion_message::BlindedPath;
9090
use crate::util::ser::{SeekReadable, WithoutLength, Writeable, Writer};
9191
use crate::util::string::PrintableString;
9292

@@ -578,13 +578,13 @@ mod tests {
578578
use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey};
579579
use core::convert::TryFrom;
580580
use core::time::Duration;
581+
use crate::blinded_path::{BlindedHop, BlindedPath};
581582
use crate::ln::features::{InvoiceRequestFeatures, OfferFeatures};
582583
use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
583584
use crate::offers::invoice_request::InvoiceRequestTlvStreamRef;
584585
use crate::offers::offer::OfferTlvStreamRef;
585586
use crate::offers::parse::{ParseError, SemanticError};
586587
use crate::offers::payer::PayerTlvStreamRef;
587-
use crate::onion_message::{BlindedHop, BlindedPath};
588588
use crate::util::ser::{BigSize, Writeable};
589589
use crate::util::string::PrintableString;
590590

lightning/src/onion_message/functional_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
//! Onion message testing and test utilities live here.
1111
12+
use crate::blinded_path::BlindedPath;
1213
use crate::chain::keysinterface::{NodeSigner, Recipient};
1314
use crate::ln::features::InitFeatures;
1415
use crate::ln::msgs::{self, DecodeError, OnionMessageHandler};
15-
use super::{BlindedPath, CustomOnionMessageContents, CustomOnionMessageHandler, Destination, OnionMessageContents, OnionMessenger, SendError};
16+
use super::{CustomOnionMessageContents, CustomOnionMessageHandler, Destination, OnionMessageContents, OnionMessenger, SendError};
1617
use crate::util::ser::{Writeable, Writer};
1718
use crate::util::test_utils;
1819

0 commit comments

Comments
 (0)