Skip to content

Commit 122c965

Browse files
Expose blinded payment paths' advance_path_by_one.
Useful for LDK users that are only using the onion messages module, like LNDK.
1 parent 3071bbb commit 122c965

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,12 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
281281
utils::construct_blinded_hops(secp_ctx, pks, tlvs, session_priv)
282282
}
283283

284-
// Advance the blinded onion payment path by one hop, so make the second hop into the new
285-
// introduction node.
286-
//
287-
// Will only modify `path` when returning `Ok`.
288-
pub(crate) fn advance_path_by_one<NS: Deref, NL: Deref, T>(
284+
/// Advance the blinded onion payment path by one hop, so make the second hop into the new
285+
/// introduction node. Useful if we are paying to a [`BlindedPath`] where we are the introduction
286+
/// node, since the payment should then be forwarded to the node after us in the path.
287+
///
288+
/// Will only modify `path` when returning `Ok`.
289+
pub fn advance_payment_path_by_one<NS: Deref, NL: Deref, T>(
289290
path: &mut BlindedPath, node_signer: &NS, node_id_lookup: &NL, secp_ctx: &Secp256k1<T>
290291
) -> Result<(), ()>
291292
where

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
1414
use bitcoin::secp256k1::{self, Secp256k1, SecretKey};
1515

1616
use crate::blinded_path::{IntroductionNode, NodeIdLookUp};
17-
use crate::blinded_path::payment::advance_path_by_one;
17+
use crate::blinded_path::payment::advance_payment_path_by_one;
1818
use crate::events::{self, PaymentFailureReason};
1919
use crate::ln::types::{PaymentHash, PaymentPreimage, PaymentSecret};
2020
use crate::ln::channel_state::ChannelDetails;
@@ -834,7 +834,7 @@ impl OutboundPayments {
834834
},
835835
};
836836
if introduction_node_id == our_node_id {
837-
let _ = advance_path_by_one(path, node_signer, node_id_lookup, secp_ctx);
837+
let _ = advance_payment_path_by_one(path, node_signer, node_id_lookup, secp_ctx);
838838
}
839839
}
840840
}

0 commit comments

Comments
 (0)