6
1
I think I have a general understanding of how the Lightning Network works. However, I was having a little difficulty in understanding what happens when a node in the middle of a "path" suddenly goes dormant, or offline for a long time. To clarify my question, consider the following example:
- A wants to make a payment of 1 BTC to D.
- A finds a path from A --> B --> C --> D.
- D generates an R and sends H = hash(R) to A
- A creates HTLC of 1.002 BTC with B.
- B creates HTLC of 1.001 BTC with C.
- C creates HTLC of 1 BTC with D.
- D unlocks HTLC, receives 1 BTC, and then tells R to C.
However, what if C is suddenly offline meaning C won't be there to receive R from D and thus stops the flow of R back through the path. I would assume that the HTLC's between A and B and B and C run out and so A and B are refunded.
So, would C lose out? Would A have just made a "free" transaction? I assume this is a fast process, but is it likely such an event occurs where a middle node in an LN transaction just goes down for a long while?
2Yes, I am aware of that, but say D claims the payment and discloses R and right before that C disappears (and does not come back for the duration of the HTLC). Thus, B can claim funds twice. Is this correct and/or realistic? Or is the whole process so fast that this scenario is unlikely? – crypto_rob – 2017-10-27T16:13:31.090
yes, if C disappears after having sent value out, and before D claims the value - and stays gone until after the timelock expires, then B can claim the value from A and reclaim the value from B. – Jonathan Silverblood – 2017-10-27T18:26:42.990
Alright, that's exactly how I thought it would work. How fast does this transaction stream happen? How fast would C have to disconnect after relaying the transaction for this to happen? I assume ms or even less. – crypto_rob – 2017-10-27T18:56:06.433
depends mostly on the network latencies of involved parties. likely to be sub-second in most cases, but could go up to a few seconds in less than ideal conditions. – Jonathan Silverblood – 2017-10-27T19:36:36.490
Also, I guess that if, say B tried to force C to disconnect via some sort of attack in order to get double pay, C could commit the commitment tx and thus "pull out" of the channel. Sorry, sort of digressing into more of a discussion than a Q/A. – crypto_rob – 2017-10-27T19:43:28.280
if you are considering this from an adversial perspective, remember that the timelock is significantly longer, and that if C detects the condition they will likely have well enough time to manually copy the transaction and broadcast it from a different node, meaning that to successfully do this as an attack where you control B and D you would need to render C completely incapable of taking action. – Jonathan Silverblood – 2017-10-27T19:44:18.403
Getting warnings about length of comment section extending too far. I think you've got me going in right direction, thanks! – crypto_rob – 2017-10-27T19:51:05.420
LN will have a monitoring service, C can give it sufficient information for the monitoring service to recover the fund for C if he has not done it. – Helin Wang – 2018-03-23T00:22:15.653