Skip to content

Commit 8aae34e

Browse files
Merge pull request #3807 from a-mpch/2025-05-rename-from-raw-to-from-blinded-path-payment
Rename `from_raw` to `from_blinded_path_and_payinfo` in `BlindedPaymentPath`
2 parents ee0830c + 9284298 commit 8aae34e

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

fuzz/src/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
401401
encrypted_payload: Vec::new(),
402402
});
403403
}
404-
BlindedPaymentPath::from_raw(
404+
BlindedPaymentPath::from_blinded_path_and_payinfo(
405405
hop.src_node_id,
406406
dummy_pk,
407407
blinded_hops,

lightning/src/blinded_path/payment.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,27 @@ impl BlindedPaymentPath {
246246
Self { inner_path, payinfo }
247247
}
248248

249-
#[cfg(any(test, fuzzing))]
250-
pub fn from_raw(
249+
/// Builds a new [`BlindedPaymentPath`] from its constituent parts.
250+
///
251+
/// Useful when reconstructing a blinded path from previously serialized components.
252+
///
253+
/// Parameters:
254+
/// * `introduction_node_id`: The public key of the introduction node in the path.
255+
/// * `blinding_point`: The public key used for blinding the path.
256+
/// * `blinded_hops`: The encrypted routing information for each hop in the path.
257+
/// * `payinfo`: The [`BlindedPayInfo`] for the blinded path.
258+
pub fn from_blinded_path_and_payinfo(
251259
introduction_node_id: PublicKey, blinding_point: PublicKey, blinded_hops: Vec<BlindedHop>,
252260
payinfo: BlindedPayInfo,
253261
) -> Self {
254-
Self {
255-
inner_path: BlindedPath {
262+
Self::from_parts(
263+
BlindedPath {
256264
introduction_node: IntroductionNode::NodeId(introduction_node_id),
257265
blinding_point,
258266
blinded_hops,
259267
},
260268
payinfo,
261-
}
269+
)
262270
}
263271

264272
#[cfg(test)]

lightning/src/ln/max_payment_path_len_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ fn bolt12_invoice_too_large_blinded_paths() {
375375
create_announced_chan_between_nodes(&nodes, 0, 1);
376376

377377
nodes[1].router.expect_blinded_payment_paths(vec![
378-
BlindedPaymentPath::from_raw(
378+
BlindedPaymentPath::from_blinded_path_and_payinfo(
379379
PublicKey::from_slice(&[2; 33]).unwrap(), PublicKey::from_slice(&[2; 33]).unwrap(),
380380
vec![
381381
BlindedHop {

lightning/src/ln/msgs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6067,7 +6067,7 @@ mod tests {
60676067
let trampoline_payload = OutboundTrampolinePayload::LegacyBlindedPathEntry {
60686068
amt_to_forward: 150_000_000,
60696069
outgoing_cltv_value: 800_000,
6070-
payment_paths: vec![BlindedPaymentPath::from_raw(
6070+
payment_paths: vec![BlindedPaymentPath::from_blinded_path_and_payinfo(
60716071
introduction_node,
60726072
blinding_point,
60736073
vec![],

lightning/src/offers/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub(super) fn privkey(byte: u8) -> SecretKey {
7474

7575
pub(crate) fn payment_paths() -> Vec<BlindedPaymentPath> {
7676
vec![
77-
BlindedPaymentPath::from_raw(
77+
BlindedPaymentPath::from_blinded_path_and_payinfo(
7878
pubkey(40),
7979
pubkey(41),
8080
vec![
@@ -90,7 +90,7 @@ pub(crate) fn payment_paths() -> Vec<BlindedPaymentPath> {
9090
features: BlindedHopFeatures::empty(),
9191
},
9292
),
93-
BlindedPaymentPath::from_raw(
93+
BlindedPaymentPath::from_blinded_path_and_payinfo(
9494
pubkey(40),
9595
pubkey(41),
9696
vec![

lightning/src/routing/router.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3827,7 +3827,7 @@ mod tests {
38273827
}
38283828

38293829
fn dummy_blinded_path(intro_node: PublicKey, payinfo: BlindedPayInfo) -> BlindedPaymentPath {
3830-
BlindedPaymentPath::from_raw(
3830+
BlindedPaymentPath::from_blinded_path_and_payinfo(
38313831
intro_node, ln_test_utils::pubkey(42),
38323832
vec![
38333833
BlindedHop { blinded_node_id: ln_test_utils::pubkey(42 as u8), encrypted_payload: Vec::new() },
@@ -3838,7 +3838,7 @@ mod tests {
38383838
}
38393839

38403840
fn dummy_one_hop_blinded_path(intro_node: PublicKey, payinfo: BlindedPayInfo) -> BlindedPaymentPath {
3841-
BlindedPaymentPath::from_raw(
3841+
BlindedPaymentPath::from_blinded_path_and_payinfo(
38423842
intro_node, ln_test_utils::pubkey(42),
38433843
vec![
38443844
BlindedHop { blinded_node_id: ln_test_utils::pubkey(42 as u8), encrypted_payload: Vec::new() },
@@ -7871,7 +7871,9 @@ mod tests {
78717871
cltv_expiry_delta: 15,
78727872
features: BlindedHopFeatures::empty(),
78737873
};
7874-
let blinded_path = BlindedPaymentPath::from_raw(nodes[2], ln_test_utils::pubkey(42), blinded_hops, blinded_payinfo.clone());
7874+
let blinded_path = BlindedPaymentPath::from_blinded_path_and_payinfo(
7875+
nodes[2], ln_test_utils::pubkey(42), blinded_hops, blinded_payinfo.clone()
7876+
);
78757877
let payment_params = PaymentParameters::blinded(vec![blinded_path.clone(), blinded_path.clone()]);
78767878

78777879
// Make sure we can round-trip read and write blinded payment params.
@@ -7992,7 +7994,9 @@ mod tests {
79927994

79937995
let mut blinded_payinfo_2 = blinded_payinfo_1;
79947996
blinded_payinfo_2.htlc_maximum_msat = 70_000;
7995-
let blinded_path_2 = BlindedPaymentPath::from_raw(nodes[2], ln_test_utils::pubkey(43),
7997+
let blinded_path_2 = BlindedPaymentPath::from_blinded_path_and_payinfo(
7998+
nodes[2],
7999+
ln_test_utils::pubkey(43),
79968000
vec![
79978001
BlindedHop { blinded_node_id: ln_test_utils::pubkey(42 as u8), encrypted_payload: Vec::new() },
79988002
BlindedHop { blinded_node_id: ln_test_utils::pubkey(42 as u8), encrypted_payload: Vec::new() }

0 commit comments

Comments
 (0)