Skip to content

Commit efed905

Browse files
Move blinded_path and its utils into a new module
1 parent b8ed4d2 commit efed905

File tree

14 files changed

+31
-31
lines changed

14 files changed

+31
-31
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!() }
@@ -104,6 +104,7 @@ use bitcoin::util::schnorr::TweakedPublicKey;
104104
use core::convert::{Infallible, TryFrom};
105105
use core::time::Duration;
106106
use crate::io;
107+
use crate::blinded_path::BlindedPath;
107108
use crate::ln::PaymentHash;
108109
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
109110
use crate::ln::inbound_payment::ExpandedKey;
@@ -115,7 +116,6 @@ use crate::offers::parse::{ParseError, ParsedMessage, SemanticError};
115116
use crate::offers::payer::{PAYER_METADATA_TYPE, PayerTlvStream, PayerTlvStreamRef};
116117
use crate::offers::refund::{IV_BYTES as REFUND_IV_BYTES, Refund, RefundContents};
117118
use crate::offers::signer;
118-
use crate::onion_message::BlindedPath;
119119
use crate::util::ser::{HighZeroBytesDroppedBigSize, Iterable, SeekReadable, WithoutLength, Writeable, Writer};
120120

121121
use crate::prelude::*;
@@ -926,6 +926,7 @@ mod tests {
926926
use bitcoin::util::schnorr::TweakedPublicKey;
927927
use core::convert::TryFrom;
928928
use core::time::Duration;
929+
use crate::blinded_path::{BlindedHop, BlindedPath};
929930
use crate::chain::keysinterface::KeyMaterial;
930931
use crate::ln::features::Bolt12InvoiceFeatures;
931932
use crate::ln::inbound_payment::ExpandedKey;
@@ -937,7 +938,6 @@ mod tests {
937938
use crate::offers::payer::PayerTlvStreamRef;
938939
use crate::offers::refund::RefundBuilder;
939940
use crate::offers::test_utils::*;
940-
use crate::onion_message::{BlindedHop, BlindedPath};
941941
use crate::util::ser::{BigSize, Iterable, Writeable};
942942

943943
trait ToBytes {

lightning/src/offers/invoice_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ use core::convert::{Infallible, TryFrom};
6060
use core::ops::Deref;
6161
use crate::chain::keysinterface::EntropySource;
6262
use crate::io;
63+
use crate::blinded_path::BlindedPath;
6364
use crate::ln::PaymentHash;
6465
use crate::ln::features::InvoiceRequestFeatures;
6566
use crate::ln::inbound_payment::{ExpandedKey, IV_LEN, Nonce};
@@ -70,7 +71,6 @@ use crate::offers::offer::{Offer, OfferContents, OfferTlvStream, OfferTlvStreamR
7071
use crate::offers::parse::{ParseError, ParsedMessage, SemanticError};
7172
use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
7273
use crate::offers::signer::{Metadata, MetadataMaterial};
73-
use crate::onion_message::BlindedPath;
7474
use crate::util::ser::{HighZeroBytesDroppedBigSize, SeekReadable, WithoutLength, Writeable, Writer};
7575
use crate::util::string::PrintableString;
7676

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
//! #
@@ -76,14 +76,14 @@ use core::str::FromStr;
7676
use core::time::Duration;
7777
use crate::chain::keysinterface::EntropySource;
7878
use crate::io;
79+
use crate::blinded_path::BlindedPath;
7980
use crate::ln::features::OfferFeatures;
8081
use crate::ln::inbound_payment::{ExpandedKey, IV_LEN, Nonce};
8182
use crate::ln::msgs::MAX_VALUE_MSAT;
8283
use crate::offers::invoice_request::{DerivedPayerId, ExplicitPayerId, InvoiceRequestBuilder};
8384
use crate::offers::merkle::TlvStream;
8485
use crate::offers::parse::{Bech32Encode, ParseError, ParsedMessage, SemanticError};
8586
use crate::offers::signer::{Metadata, MetadataMaterial, self};
86-
use crate::onion_message::BlindedPath;
8787
use crate::util::ser::{HighZeroBytesDroppedBigSize, WithoutLength, Writeable, Writer};
8888
use crate::util::string::PrintableString;
8989

@@ -832,13 +832,13 @@ mod tests {
832832
use core::convert::TryFrom;
833833
use core::num::NonZeroU64;
834834
use core::time::Duration;
835+
use crate::blinded_path::{BlindedHop, BlindedPath};
835836
use crate::chain::keysinterface::KeyMaterial;
836837
use crate::ln::features::OfferFeatures;
837838
use crate::ln::inbound_payment::ExpandedKey;
838839
use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
839840
use crate::offers::parse::{ParseError, SemanticError};
840841
use crate::offers::test_utils::*;
841-
use crate::onion_message::{BlindedHop, BlindedPath};
842842
use crate::util::ser::{BigSize, Writeable};
843843
use crate::util::string::PrintableString;
844844

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
//! #
@@ -80,6 +80,7 @@ use core::str::FromStr;
8080
use core::time::Duration;
8181
use crate::chain::keysinterface::EntropySource;
8282
use crate::io;
83+
use crate::blinded_path::BlindedPath;
8384
use crate::ln::PaymentHash;
8485
use crate::ln::features::InvoiceRequestFeatures;
8586
use crate::ln::inbound_payment::{ExpandedKey, IV_LEN, Nonce};
@@ -90,7 +91,6 @@ use crate::offers::offer::{OfferTlvStream, OfferTlvStreamRef};
9091
use crate::offers::parse::{Bech32Encode, ParseError, ParsedMessage, SemanticError};
9192
use crate::offers::payer::{PayerContents, PayerTlvStream, PayerTlvStreamRef};
9293
use crate::offers::signer::{Metadata, MetadataMaterial, self};
93-
use crate::onion_message::BlindedPath;
9494
use crate::util::ser::{SeekReadable, WithoutLength, Writeable, Writer};
9595
use crate::util::string::PrintableString;
9696

@@ -697,6 +697,7 @@ mod tests {
697697
use bitcoin::secp256k1::{KeyPair, Secp256k1, SecretKey};
698698
use core::convert::TryFrom;
699699
use core::time::Duration;
700+
use crate::blinded_path::{BlindedHop, BlindedPath};
700701
use crate::chain::keysinterface::KeyMaterial;
701702
use crate::ln::features::{InvoiceRequestFeatures, OfferFeatures};
702703
use crate::ln::inbound_payment::ExpandedKey;
@@ -706,7 +707,6 @@ mod tests {
706707
use crate::offers::parse::{ParseError, SemanticError};
707708
use crate::offers::payer::PayerTlvStreamRef;
708709
use crate::offers::test_utils::*;
709-
use crate::onion_message::{BlindedHop, BlindedPath};
710710
use crate::util::ser::{BigSize, Writeable};
711711
use crate::util::string::PrintableString;
712712

lightning/src/offers/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use bitcoin::secp256k1::{KeyPair, Message, PublicKey, Secp256k1, SecretKey};
1313
use bitcoin::secp256k1::schnorr::Signature;
1414
use core::convert::Infallible;
1515
use core::time::Duration;
16+
use crate::blinded_path::{BlindedHop, BlindedPath};
1617
use crate::chain::keysinterface::EntropySource;
1718
use crate::ln::PaymentHash;
1819
use crate::ln::features::BlindedHopFeatures;
1920
use crate::offers::invoice::BlindedPayInfo;
20-
use crate::onion_message::{BlindedHop, BlindedPath};
2121

2222
pub(super) fn payer_keys() -> KeyPair {
2323
let secp_ctx = Secp256k1::new();

0 commit comments

Comments
 (0)