Skip to content

Commit 4d726fc

Browse files
committed
Rename Padding -> BlindedPathPadding
Renaming the struct to `BlindedPathPadding` makes its purpose explicit, clarifying that it is specifically used for `Blinded{Message/Payment}Paths`.
1 parent 5bc9ffa commit 4d726fc

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ impl Readable for BlindedPaymentTlvs {
530530
(65537, payment_context, option),
531531
(65539, authentication, option),
532532
});
533-
let _padding: Option<utils::Padding> = _padding;
533+
let _padding: Option<utils::BlindedPathPadding> = _padding;
534534

535535
if let Some(short_channel_id) = scid {
536536
if payment_secret.is_some() {

lightning/src/blinded_path/utils.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ fn encrypt_payload<P: Writeable>(payload: P, encrypted_tlvs_rho: [u8; 32]) -> Ve
196196
write_adapter.encode()
197197
}
198198

199-
/// Blinded path encrypted payloads may be padded to ensure they are equal length.
199+
/// A data structure used exclusively to pad blinded path payloads, ensuring they are of
200+
/// equal length. Padding is written at Type 1 for compatibility with the lightning specification.
200201
///
201-
/// Reads padding to the end, ignoring what's read.
202-
pub(crate) struct Padding {}
203-
impl Readable for Padding {
202+
/// For more details, see the [BOLTs Specification - Encrypted Recipient Data](https://github.com/lightning/bolts/blob/8707471dbc23245fb4d84c5f5babac1197f1583e/04-onion-routing.md#inside-encrypted_recipient_data-encrypted_data_tlv).
203+
pub(crate) struct BlindedPathPadding {}
204+
impl Readable for BlindedPathPadding {
204205
#[inline]
205206
fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
206207
loop {

lightning/src/onion_message/packet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use super::dns_resolution::DNSResolverMessage;
1818
use super::messenger::CustomOnionMessageHandler;
1919
use super::offers::OffersMessage;
2020
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, NextMessageHop, ReceiveTlvs};
21-
use crate::blinded_path::utils::Padding;
21+
use crate::blinded_path::utils::BlindedPathPadding;
2222
use crate::crypto::streams::{ChaChaPolyReadAdapter, ChaChaPolyWriteAdapter};
2323
use crate::ln::msgs::DecodeError;
2424
use crate::ln::onion_utils;
@@ -342,7 +342,7 @@ impl Readable for ControlTlvs {
342342
(8, next_blinding_override, option),
343343
(65537, context, option),
344344
});
345-
let _padding: Option<Padding> = _padding;
345+
let _padding: Option<BlindedPathPadding> = _padding;
346346

347347
let next_hop = match (short_channel_id, next_node_id) {
348348
(Some(_), Some(_)) => return Err(DecodeError::InvalidValue),

0 commit comments

Comments
 (0)