<oembed><type>rich</type><version>1.0</version><author_name>npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_name><author_url>https://nostr.ae/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-09-24&#xA;📝 Original message:&#xA;On Thu, Sep 22, 2022 at 08:40:30AM +0200, René Pickhardt via Lightning-dev wrote:&#xA;&gt; While trying to estimate the expected liquidity distribution in depleted&#xA;&gt; channels due to drain via Markov Models I realized that we can exploit the&#xA;&gt; `htlc_maxium_msat` setting to act as a control valve and regulate the&#xA;&gt; &#34;pressure&#34; coming from the drain and mitigate the depletion of channels.&#xA;&#xA;This is really neat!&#xA;&#xA;I think &#34;channel drain&#34; confounds two issues (or, at least, I do when&#xA;I think about it):&#xA;&#xA; 1) one is you&#39;re trying to collect as many forwarding fees as you can,&#xA;    and since a drained channel prevents you from forwarding txs, that&#xA;    feels like a hit on profits&#xA;&#xA; 2) the other is that a drained channel *can&#39;t* forward a payment even&#xA;    for no profit, so even attempting to forward a payment over a drained&#xA;    channel wastes everyone&#39;s time, increases payment latency, and may&#xA;    increase payment failures if you go through too many failures without&#xA;    finding a successful path&#xA;&#xA;This seems like a great idea for solving (2) -- if you make lightning&#xA;nodes look at htlc_max_msat and throttle their use of a channel based&#xA;on its value, then channels can set that value so that their payment&#xA;flow is balanced on average, at which point depletion becomes rare,&#xA;and payments usually succeed.&#xA;&#xA;I think a simple way of thinking about it is: suppose people are&#xA;forwarding X BTC per hour through a channel in one direction, and 2X BTC&#xA;through it in the other direction, with all payments being 1000 sats&#xA;exactly. Then if you set htlc_max_msat to 500sats on the overloaded&#xA;direction, and everyone then triggers their AMP paths and sends half&#xA;their payments through a slightly more expensive path, you&#39;ll be at&#xA;X-vs-X BTC per hour, with balanced flows and stable channel balances.&#xA;&#xA;OTOH, it is relying on senders doing things that are slightly less optimal&#xA;in the short term (pay higher fees) for things that benefit them only in&#xA;the long term (avoid payment latency/failures due to depleted channels),&#xA;and only if most people cooperate. Perhaps there&#39;s some privacy-preserving&#xA;way that channel operators could throttle payments based on htlc_max_msat&#xA;(and channel depletion percentage?) as well, so that cheaters are less&#xA;likely to prosper?&#xA;&#xA;&#xA;&#xA;But as far as (1) goes -- this isn&#39;t actually an improvement: instead&#xA;of rejecting X BTC per hour from the overloaded direction because&#xA;your channel&#39;s depleted, you&#39;re now not even getting the opportunity&#xA;to forward those payments and collect the corresponding fees. It&#39;s no&#xA;worse for your profit margins, but it&#39;s not any better. (And it could&#xA;be worse if you&#39;re throttling both sides, and only getting 0.95*X BTC&#xA;per hour in both directions.&#xA;&#xA;But there aren&#39;t many ways you can actually do better with (1).&#xA;&#xA;One way is if you have a cheap way to rebalance your channels -- in that&#xA;case, rebalance your channel, let it drain again, collecting fees all the&#xA;while, and repeat. If rebalancing is cheaper than the fees you collect,&#xA;this works great!&#xA;&#xA;The other way is if fees rates are expected to change -- if they&#39;re likely&#xA;to go down later, then you might as well deplete your channel now, since&#xA;you&#39;ll collect more fees for it now than you would later; likewise if you&#xA;expect fees to up up later, then you might want to retain some balance&#xA;now, so you can deplete it later. But that&#39;s a very dynamic situation,&#xA;and the profits are limited -- you can only drain your channel once while&#xA;waiting for fee rates to be ready to change, and your profit is going to&#xA;be capped by your channel capacity times the difference in the fee rates.&#xA;&#xA;&#xA;&#xA;This approach seems *much* better than the fee rate cards idea:&#xA;&#xA; * you&#39;re not decreasing your channel profitability half the time in&#xA;   order to avoid your channel depleting&#xA;&#xA; * you&#39;re making routing decisions *less* dependent on internal/private&#xA;   state, rather than more&#xA;&#xA; * you&#39;re not adding much gossip/probing traffic -- you might need&#xA;   to refine your htlc_max_msat a few times each time you change fees,&#xA;   but it shouldn&#39;t be often, and this should be reducing the frequency&#xA;   you have to change fees anyway&#xA;&#xA; * you&#39;re providing a way of throttling payment traffic independent of&#xA;   fees -- since fees are competitive, they can have discontinuous effects&#xA;   where a small change to fee can cause a large change to traffic volume;&#xA;   but this seems like it should mostly have a proportional response,&#xA;   with a small decrease in htlc_max_msat resulting in a small decrease in&#xA;   payment volume, and conversely. Much better for stability/optimisation!&#xA;&#xA;Cheers,&#xA;aj</html></oembed>