Skip to content

Commit 44570fd

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 1434e9c commit 44570fd

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
@@ -516,7 +516,7 @@ impl Readable for BlindedPaymentTlvs {
516516
(65537, payment_context, option),
517517
(65539, authentication, option),
518518
});
519-
let _padding: Option<utils::Padding> = _padding;
519+
let _padding: Option<utils::BlindedPathPadding> = _padding;
520520

521521
if let Some(short_channel_id) = scid {
522522
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
@@ -13,7 +13,7 @@ use bitcoin::secp256k1::PublicKey;
1313
use bitcoin::secp256k1::ecdh::SharedSecret;
1414

1515
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, NextMessageHop, ReceiveTlvs};
16-
use crate::blinded_path::utils::Padding;
16+
use crate::blinded_path::utils::BlindedPathPadding;
1717
use crate::ln::msgs::DecodeError;
1818
use crate::ln::onion_utils;
1919
#[cfg(async_payments)]
@@ -348,7 +348,7 @@ impl Readable for ControlTlvs {
348348
(8, next_blinding_override, option),
349349
(65537, context, option),
350350
});
351-
let _padding: Option<Padding> = _padding;
351+
let _padding: Option<BlindedPathPadding> = _padding;
352352

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

0 commit comments

Comments
 (0)