Skip to content

Commit 030740d

Browse files
committed
Make onion_utils public rather than re-exporting
1 parent b06ba92 commit 030740d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lightning/src/events/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ use crate::chain::transaction;
2626
use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS;
2727
use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields};
2828
use crate::ln::types::ChannelId;
29-
use crate::ln::{msgs, LocalHTLCFailureReason};
29+
use crate::ln::onion_utils::LocalHTLCFailureReason;
30+
use crate::ln::msgs;
3031
use crate::offers::invoice::Bolt12Invoice;
3132
use crate::offers::invoice_request::InvoiceRequest;
3233
use crate::offers::static_invoice::StaticInvoice;

lightning/src/ln/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ pub mod channel;
4141
#[cfg(not(fuzzing))]
4242
pub(crate) mod channel;
4343

44-
pub(crate) mod onion_utils;
44+
pub mod onion_utils;
4545
pub mod outbound_payment;
4646
pub mod wire;
4747

4848
#[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled.
4949
pub(crate) mod interactivetxs;
5050

51-
pub use onion_utils::{create_payment_onion, LocalHTLCFailureReason};
5251
// Older rustc (which we support) refuses to let us call the get_payment_preimage_hash!() macro
5352
// without the node parameter being mut. This is incorrect, and thus newer rustcs will complain
5453
// about an unnecessary mut. Thus, we silence the unused_mut warning in two test modules below.

lightning/src/ln/onion_utils.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10+
//! Utilities for handling and manipulating onions
11+
1012
use super::msgs::OnionErrorPacket;
1113
use crate::blinded_path::BlindedHop;
1214
use crate::crypto::chacha20::ChaCha20;
@@ -985,7 +987,7 @@ pub use self::fuzzy_onion_utils::*;
985987
#[cfg(not(fuzzing))]
986988
pub(crate) use self::fuzzy_onion_utils::*;
987989

988-
pub fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
990+
pub(crate) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
989991
secp_ctx: &Secp256k1<T>, logger: &L, htlc_source: &HTLCSource,
990992
encrypted_packet: OnionErrorPacket,
991993
) -> DecodedOnionFailure
@@ -1467,7 +1469,7 @@ where
14671469
}
14681470

14691471
/// Decodes the attribution data that we got back from upstream on a payment we sent.
1470-
pub fn decode_fulfill_attribution_data<T: secp256k1::Signing, L: Deref>(
1472+
pub(crate) fn decode_fulfill_attribution_data<T: secp256k1::Signing, L: Deref>(
14711473
secp_ctx: &Secp256k1<T>, logger: &L, path: &Path, outer_session_priv: &SecretKey,
14721474
mut attribution_data: AttributionData,
14731475
) -> Vec<u32>
@@ -2708,16 +2710,16 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
27082710
}
27092711
}
27102712

2711-
pub const HOLD_TIME_LEN: usize = 4;
2712-
pub const MAX_HOPS: usize = 20;
2713-
pub const HMAC_LEN: usize = 4;
2713+
pub(crate) const HOLD_TIME_LEN: usize = 4;
2714+
pub(crate) const MAX_HOPS: usize = 20;
2715+
pub(crate) const HMAC_LEN: usize = 4;
27142716

27152717
// Define the number of HMACs in the attributable data block. For the first node, there are 20 HMACs, and then for every
27162718
// subsequent node, the number of HMACs decreases by 1. 20 + 19 + 18 + ... + 1 = 20 * 21 / 2 = 210.
2717-
pub const HMAC_COUNT: usize = MAX_HOPS * (MAX_HOPS + 1) / 2;
2719+
pub(crate) const HMAC_COUNT: usize = MAX_HOPS * (MAX_HOPS + 1) / 2;
27182720

27192721
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
2720-
pub struct AttributionData {
2722+
pub(crate) struct AttributionData {
27212723
pub hold_times: [u8; MAX_HOPS * HOLD_TIME_LEN],
27222724
pub hmacs: [u8; HMAC_LEN * HMAC_COUNT],
27232725
}

0 commit comments

Comments
 (0)