Skip to content

Commit c6b142e

Browse files
f avoid pubkey copies and add newline
1 parent 059eb44 commit c6b142e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lightning/src/ln/onion_utils.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ where
114114
let mut blinded_priv = session_priv.clone();
115115
let mut blinded_pub = PublicKey::from_secret_key(secp_ctx, &blinded_priv);
116116

117-
let unblinded_hops_iter = path.hops.iter().map(|h| (h.pubkey, Some(h)));
117+
let unblinded_hops_iter = path.hops.iter().map(|h| (&h.pubkey, Some(h)));
118118
let blinded_pks_iter = path.blinded_tail.as_ref()
119-
.map(|t| t.hops.iter()).unwrap_or([].iter()).skip(1) // Skip the intro node because it's included in the unblinded hops
120-
.map(|h| (h.blinded_node_id, None));
119+
.map(|t| t.hops.iter()).unwrap_or([].iter())
120+
.skip(1) // Skip the intro node because it's included in the unblinded hops
121+
.map(|h| (&h.blinded_node_id, None));
121122
for (idx, (pubkey, route_hop_opt)) in unblinded_hops_iter.chain(blinded_pks_iter).enumerate() {
122-
let shared_secret = SharedSecret::new(&pubkey, &blinded_priv);
123+
let shared_secret = SharedSecret::new(pubkey, &blinded_priv);
123124

124125
let mut sha = Sha256::engine();
125126
sha.input(&blinded_pub.serialize()[..]);

0 commit comments

Comments
 (0)