Skip to content

Commit 030a784

Browse files
authored
Merge pull request #3677 from JssDWt/jssdwt-make-blinded-path-public
make blinded path public
2 parents 05dec16 + 8ce438c commit 030a784

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

lightning/src/blinded_path/message.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,15 @@ impl BlindedMessagePath {
202202
&mut self.0.introduction_node
203203
}
204204

205-
#[cfg(test)]
206-
pub fn from_raw(
205+
/// Creates a new [`BlindedMessagePath`] from its constituent parts.
206+
///
207+
/// Useful when you need to reconstruct a blinded path from previously serialized components.
208+
///
209+
/// Parameters:
210+
/// * `introduction_node_id`: The public key of the introduction node in the path
211+
/// * `blinding_point`: The public key used for blinding the path
212+
/// * `blinded_hops`: The encrypted routing information for each hop in the path
213+
pub fn from_blinded_path(
207214
introduction_node_id: PublicKey, blinding_point: PublicKey, blinded_hops: Vec<BlindedHop>,
208215
) -> Self {
209216
Self(BlindedPath {

lightning/src/offers/invoice.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ mod tests {
21812181
let secp_ctx = Secp256k1::new();
21822182
let payment_id = PaymentId([1; 32]);
21832183

2184-
let blinded_path = BlindedMessagePath::from_raw(
2184+
let blinded_path = BlindedMessagePath::from_blinded_path(
21852185
pubkey(40),
21862186
pubkey(41),
21872187
vec![
@@ -2276,7 +2276,7 @@ mod tests {
22762276
let entropy = FixedEntropy {};
22772277
let secp_ctx = Secp256k1::new();
22782278

2279-
let blinded_path = BlindedMessagePath::from_raw(
2279+
let blinded_path = BlindedMessagePath::from_blinded_path(
22802280
pubkey(40),
22812281
pubkey(41),
22822282
vec![
@@ -2982,15 +2982,15 @@ mod tests {
29822982
let payment_id = PaymentId([1; 32]);
29832983

29842984
let paths = vec![
2985-
BlindedMessagePath::from_raw(
2985+
BlindedMessagePath::from_blinded_path(
29862986
pubkey(40),
29872987
pubkey(41),
29882988
vec![
29892989
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
29902990
BlindedHop { blinded_node_id: pubkey(44), encrypted_payload: vec![0; 44] },
29912991
],
29922992
),
2993-
BlindedMessagePath::from_raw(
2993+
BlindedMessagePath::from_blinded_path(
29942994
pubkey(40),
29952995
pubkey(41),
29962996
vec![
@@ -3532,7 +3532,7 @@ mod tests {
35323532
.sign(recipient_sign)
35333533
.unwrap();
35343534

3535-
let blinded_path = BlindedMessagePath::from_raw(
3535+
let blinded_path = BlindedMessagePath::from_blinded_path(
35363536
pubkey(40),
35373537
pubkey(41),
35383538
vec![

lightning/src/offers/offer.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ mod tests {
14621462
let secp_ctx = Secp256k1::new();
14631463
let payment_id = PaymentId([1; 32]);
14641464

1465-
let blinded_path = BlindedMessagePath::from_raw(
1465+
let blinded_path = BlindedMessagePath::from_blinded_path(
14661466
pubkey(40),
14671467
pubkey(41),
14681468
vec![
@@ -1643,15 +1643,15 @@ mod tests {
16431643
#[test]
16441644
fn builds_offer_with_paths() {
16451645
let paths = vec![
1646-
BlindedMessagePath::from_raw(
1646+
BlindedMessagePath::from_blinded_path(
16471647
pubkey(40),
16481648
pubkey(41),
16491649
vec![
16501650
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
16511651
BlindedHop { blinded_node_id: pubkey(44), encrypted_payload: vec![0; 44] },
16521652
],
16531653
),
1654-
BlindedMessagePath::from_raw(
1654+
BlindedMessagePath::from_blinded_path(
16551655
pubkey(40),
16561656
pubkey(41),
16571657
vec![
@@ -1856,15 +1856,15 @@ mod tests {
18561856
#[test]
18571857
fn parses_offer_with_paths() {
18581858
let offer = OfferBuilder::new(pubkey(42))
1859-
.path(BlindedMessagePath::from_raw(
1859+
.path(BlindedMessagePath::from_blinded_path(
18601860
pubkey(40),
18611861
pubkey(41),
18621862
vec![
18631863
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
18641864
BlindedHop { blinded_node_id: pubkey(44), encrypted_payload: vec![0; 44] },
18651865
],
18661866
))
1867-
.path(BlindedMessagePath::from_raw(
1867+
.path(BlindedMessagePath::from_blinded_path(
18681868
pubkey(40),
18691869
pubkey(41),
18701870
vec![
@@ -1879,7 +1879,7 @@ mod tests {
18791879
}
18801880

18811881
let offer = OfferBuilder::new(pubkey(42))
1882-
.path(BlindedMessagePath::from_raw(
1882+
.path(BlindedMessagePath::from_blinded_path(
18831883
pubkey(40),
18841884
pubkey(41),
18851885
vec![

lightning/src/offers/refund.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ mod tests {
12191219
let secp_ctx = Secp256k1::new();
12201220
let payment_id = PaymentId([1; 32]);
12211221

1222-
let blinded_path = BlindedMessagePath::from_raw(
1222+
let blinded_path = BlindedMessagePath::from_blinded_path(
12231223
pubkey(40),
12241224
pubkey(41),
12251225
vec![
@@ -1332,15 +1332,15 @@ mod tests {
13321332
#[test]
13331333
fn builds_refund_with_paths() {
13341334
let paths = vec![
1335-
BlindedMessagePath::from_raw(
1335+
BlindedMessagePath::from_blinded_path(
13361336
pubkey(40),
13371337
pubkey(41),
13381338
vec![
13391339
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
13401340
BlindedHop { blinded_node_id: pubkey(44), encrypted_payload: vec![0; 44] },
13411341
],
13421342
),
1343-
BlindedMessagePath::from_raw(
1343+
BlindedMessagePath::from_blinded_path(
13441344
pubkey(40),
13451345
pubkey(41),
13461346
vec![
@@ -1585,15 +1585,15 @@ mod tests {
15851585
fn parses_refund_with_optional_fields() {
15861586
let past_expiry = Duration::from_secs(0);
15871587
let paths = vec![
1588-
BlindedMessagePath::from_raw(
1588+
BlindedMessagePath::from_blinded_path(
15891589
pubkey(40),
15901590
pubkey(41),
15911591
vec![
15921592
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
15931593
BlindedHop { blinded_node_id: pubkey(44), encrypted_payload: vec![0; 44] },
15941594
],
15951595
),
1596-
BlindedMessagePath::from_raw(
1596+
BlindedMessagePath::from_blinded_path(
15971597
pubkey(40),
15981598
pubkey(41),
15991599
vec![

lightning/src/offers/static_invoice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ mod tests {
779779
}
780780

781781
fn blinded_path() -> BlindedMessagePath {
782-
BlindedMessagePath::from_raw(
782+
BlindedMessagePath::from_blinded_path(
783783
pubkey(40),
784784
pubkey(41),
785785
vec![

0 commit comments

Comments
 (0)