Skip to content

Commit 059eb44

Browse files
f split iter into intermediate vars
1 parent 7501d0d commit 059eb44

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/ln/onion_utils.rs

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

117-
for (idx, (pubkey, route_hop_opt)) in path.hops.iter().map(|h| (h.pubkey, Some(h)))
118-
.chain(path.blinded_tail.as_ref().map(|t| t.hops.iter()).unwrap_or([].iter()).skip(1)
119-
.map(|h| (h.blinded_node_id, None)))
120-
.enumerate()
121-
{
117+
let unblinded_hops_iter = path.hops.iter().map(|h| (h.pubkey, Some(h)));
118+
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));
121+
for (idx, (pubkey, route_hop_opt)) in unblinded_hops_iter.chain(blinded_pks_iter).enumerate() {
122122
let shared_secret = SharedSecret::new(&pubkey, &blinded_priv);
123123

124124
let mut sha = Sha256::engine();

0 commit comments

Comments
 (0)