<oembed><type>rich</type><version>1.0</version><title>Rusty Russell [ARCHIVE] wrote</title><author_name>Rusty Russell [ARCHIVE] (npub1zw…hkhpx)</author_name><author_url>https://yabu.me/npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-02-21&#xA;📝 Original message:&#xA;Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt; On Tue, Feb 18, 2020 at 10:23:29AM +0100, Joost Jager wrote:&#xA;&gt;&gt; A different way of mitigating this is to reverse the direction in which the&#xA;&gt;&gt; bond is paid. So instead of paying to offer an htlc, nodes need to pay to&#xA;&gt;&gt; receive an htlc. This sounds counterintuitive, but for the described jamming&#xA;&gt;&gt; attack there is also an attacker node at the end of the route. The attacker&#xA;&gt;&gt; still pays.&#xA;&gt;&#xA;&gt; I think this makes a lot of sense. I think the way it would end up working&#xA;&gt; is that the further the route extends, the greater the payments are, so:&#xA;&gt;&#xA;&gt;   A -&gt; B   : B sends A 1msat per minute&#xA;&gt;   A -&gt; B -&gt; C : C sends B 2msat per minute, B forwards 1msat/min to A&#xA;&gt;   A -&gt; B -&gt; C -&gt; D : D sends C 3 msat, etc&#xA;&gt;   A -&gt; B -&gt; C -&gt; D -&gt; E : E sends D 4 msat, etc&#xA;&gt;&#xA;&gt; so each node is receiving +1 msat/minute, except for the last one, who&#39;s&#xA;&gt; paying n msat/minute, where n is the number of hops to have gotten up to&#xA;&gt; the last one. There&#39;s the obvious privacy issue there, with fairly&#xA;&gt; obvious ways to fudge around it, I think.&#xA;&#xA;Yes, it needs to scale with distance to work at all.  However, it has&#xA;the same problems with other upfront schemes: how does E know to send&#xA;4msat per minute?&#xA;&#xA;&gt; I think it might make sense for the payments to have a grace period --&#xA;&gt; ie, &#34;if you keep this payment open longer than 20 seconds, you have to&#xA;&gt; start paying me x msat/minute, but if it fulfills or cancels before&#xA;&gt; then, it&#39;s all good&#34;.&#xA;&#xA;But whatever the grace period, I can just rely on knowing that B is in&#xA;Australia (with a 1 second HTLC commit time) to make that node bleed&#xA;satoshis.  I can send A-&gt;B-&gt;C, and have C fail the htlc after 19&#xA;seconds for free.  But B has to send 1msat to A.  B can&#39;t blame A or C,&#xA;since this attack could come from further away, too.&#xA;&#xA;This attack always seems possible.  Are you supposed to pay immediately&#xA;to fail an HTLC?  That makes for a trivial attack, so I guess not.&#xA;&#xA;And if there is a grace period, I can just gum up the network with lots&#xA;of slow-but-not-slow-enough HTLCs.&#xA;&#xA;&gt; Maybe this also implies a different protocol for HTLC forwarding,&#xA;&gt; something like:&#xA;&gt;&#xA;&gt;   1. A sends the HTLC onion packet to B&#xA;&gt;   2. B decrypts it, makes sure it makes sense&#xA;&gt;   3. B sends a half-signed updated channel state back to A&#xA;&gt;   4. A accepts it, and forwards the other half-signed channel update to B&#xA;&gt;&#xA;&gt; so that at any point before (4) Alice can say &#34;this is taking too long,&#xA;&gt; I&#39;ll start losing money&#34; and safely abort the HTLC she was forwarding to&#xA;&gt; Bob to avoid paying fees; while only after (4) can she start the time on&#xA;&gt; expecting Bob to start paying fees that she&#39;ll forward back. That means&#xA;&gt; 1.5 round-trips before Bob can really forward the HTLC on to Carol;&#xA;&gt; but maybe it&#39;s parallelisable, so Bob/Carol could start at (1) as soon&#xA;&gt; as Alice/Bob has finished (2).&#xA;&#xA;We added a ping-before-commit[1] to avoid the case where B has disconnected&#xA;and we don&#39;t know yet; we have to assume an HTLC is stuck once we send&#xA;commitment_signed.  This would be a formalization of that, but I don&#39;t&#xA;think it&#39;s any better?&#xA;&#xA;There&#39;s an old proposal to fast-fail HTLCs: Bob sends an new message &#34;I&#xA;would fail this HTLC once it&#39;s committed, here&#39;s the error&#34; and if Alice&#xA;gets it before she sends the commitment_signed, she sends a new&#xA;&#34;unadd_htlc&#34; message first.  This theoretically allows Bob to do the&#xA;same: optimistically forward it, and unadd it if Alice doesn&#39;t commit&#xA;with it in time.[2]&#xA;&#xA;Cheers,&#xA;Rusty.&#xA;&#xA;[1] Technically, if we haven&#39;t seen any traffic from the peer in the&#xA;    last 30 seconds, we send a ping and wait.&#xA;&#xA;[2] This seems like a speedup, but it only is if someone fails the HTLC.&#xA;    We still need to send the commitment_signed back and forth (w/&#xA;    revoke and ack) before committing to it in the next hop.</html></oembed>