/// Construct blinded onion message hops for the given `intermediate_nodes` and `recipient_node_id`.
pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
- secp_ctx: &Secp256k1<T>, intermediate_nodes: &[ForwardNode], recipient_node_id: PublicKey,
- context: MessageContext, session_priv: &SecretKey
+ secp_ctx: &Secp256k1<T>, intermediate_nodes: &[MessageForwardNode],
+ recipient_node_id: PublicKey, context: MessageContext, session_priv: &SecretKey,
) -> Result<Vec<BlindedHop>, secp256k1::Error> {
- let pks = intermediate_nodes.iter().map(|node| &node.node_id)
- .chain(core::iter::once(&recipient_node_id));
+ let pks = intermediate_nodes.iter().map(|node| node.node_id)
+ .chain(core::iter::once(recipient_node_id));
let tlvs = pks.clone()
.skip(1) // The first node's TLVs contains the next node's pubkey
.zip(intermediate_nodes.iter().map(|node| node.short_channel_id))
/// Construct blinded payment hops for the given `intermediate_nodes` and payee info.
pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
- secp_ctx: &Secp256k1<T>, intermediate_nodes: &[ForwardNode],
- payee_node_id: PublicKey, payee_tlvs: ReceiveTlvs, session_priv: &SecretKey
+ secp_ctx: &Secp256k1<T>, intermediate_nodes: &[PaymentForwardNode],
+ payee_node_id: PublicKey, payee_tlvs: ReceiveTlvs, session_priv: &SecretKey,
) -> Result<Vec<BlindedHop>, secp256k1::Error> {
- let pks = intermediate_nodes.iter().map(|node| &node.node_id)
- .chain(core::iter::once(&payee_node_id));
+ let pks = intermediate_nodes.iter().map(|node| node.node_id)
+ .chain(core::iter::once(payee_node_id));
let tlvs = intermediate_nodes.iter().map(|node| BlindedPaymentTlvsRef::Forward(&node.tlvs))
.chain(core::iter::once(BlindedPaymentTlvsRef::Receive(&payee_tlvs)));
- utils::construct_blinded_hops(secp_ctx, pks, tlvs, session_priv)
+
+ let path = pks.zip(tlvs);
+
+ utils::construct_blinded_hops(secp_ctx, path, session_priv)
}
/// `None` if underflow occurs.