lightningnetwork / lightning-onion

Onion Routed Micropayments for the Lightning Network
MIT License
396 stars 125 forks source link

Simplify onion routing shared secret calculation loop and adjust term… #41

Open arik-so opened 4 years ago

arik-so commented 4 years ago

The loop can be started from 0 rather than from 1, and the cached blinding factor was actually the cached ephemeral private key, so I renamed the variable.

Roasbeef commented 4 years ago

I don't think this actually simplifies things. The loop starts from 1 as we've unrolled the first iteration to live outside the main loop. The variable re-name doesn't seem correct either, as it is the running cached blinding factor. I'd recommend reading the comments again, and possibly going back in the commit history to check out what the loop looked like when we had to re-compute the blinding factor for a hop from scratch each time.