How much time passes between the moment an intermediary node receives an HTLC and the moment it forwards if to the next hop? At least what order of magnitude is it? Is it comparable with network-latency (tens to hundreds of milliseconds)?
1 Answer
Short answer: Yes network Latency is should be the dominant factor here. (I have not profiled it and I am not aware of benchmarks)
If you look at bolt 02 https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc you will see that update_add_htlc
message including the onion and commitment-signed
message will have to be sent / exchanged. (revoke_and_ack
is for settling the htlcs) while decrypting the onion and producing signatures are computationally rather expensive operations (we should not forget encrypting and decrypting the lightning messages themselves according to bolt 08 and noise_xk) these operations even on a local area network should not exceed the time for network I/O.
-
Do you have an understanding about the order of magnitude of these delays? Like, is it in single milliseconds? Oct 15, 2019 at 12:56
-
I always like the times given in this excellent article norvig.com/21-days.html this should hold perfectly as estimates. So depending on the location of your channel partner the network io could be a couple hundred milliseconds. Everything else should be in the order of microseconds. But again did not measure that myself. But take a local lap and pay with your phone. See how money arrived at the LAPP but your phone has not signaled a successful payment as preimage is being propagated back (which is also mainly network io) Oct 15, 2019 at 14:05