lightningd: default public htlc_maximum_msat to 25% of channel capacity - #9311
lightningd: default public htlc_maximum_msat to 25% of channel capacity#9311nGoline wants to merge 4 commits into
Conversation
Andezion
left a comment
There was a problem hiding this comment.
Does htlc_maximum_msat get updated?
I looked at update_channel_from_inflight() in peer_control.c:2251. It updates funding_sats and the reserve after a splice, but I could not find where it also updates htlc_maximum_msat (or htlc_minimum_msat). I checked channel_gossip.c too and did not see anything there either
If I'm right - then
Splice-in (channel gets bigger) - htlc_maximum_msatstays the same old number. So it becomes a smaller and smaller part of the new, bigger capacity. This does not break any rule, but the channel ends up more limited than the 25% default was supposed to give, and the node owner has no way to know this happened. Also - if different channels end up with very different max/capacity numbers just because some were spliced and some were not, could that give away information too?
Splice-out (channel gets smaller) - could htlc_maximum_msat end up bigger than the new, smaller capacity? That would break the BOLT7 rule that says htlc_maximum_msat must be <= capacity. It looks like this would fix itself the next time lightningd restarts (because channel_htlc_maximum_default() checks and lowers the stored value again when the channel is loaded), or if someone runs setchannel. But until then, could a bad channel_update get sent out to the network?
What do you think?
| * configured --htlc-maximum-msat (AMOUNT_MSAT(-1ULL) if unset). Public | ||
| * channels default to 25% of capacity for privacy; private channels and an | ||
| * explicit setting use the full amount, all capped at what we can send. */ | ||
| struct amount_msat channel_htlc_maximum_default(const struct channel *channel, |
There was a problem hiding this comment.
channel_htlc_maximum_default() doesn't clamp the result against channel->htlc_minimum_msat. With the previous capacity default this was effectively unreachable, but with a 25% ofcapacity default it's now realistic for small public channels combined with a non-default --htlc-minimum-msat, producing a channel_update with htlc_maximum_msat < htlc_minimum_msat (channel becomes unroutable). Should this function also do deflt = amount_msat_max(deflt, channel->htlc_minimum_msat) before the final cap, or at least log a warning when that happens?
9271abb to
16fbc32
Compare
…nels The Oakland privacy proposal (Lightning Dev Summit) observes that probing for where payments went is much harder when the htlc maximum is well below the publicly-known channel capacity. Default public channels to 25% of capacity, and leave private channels, whose capacity is not public, at everything they can send. Assert both, update the setchannel tests to expect the new figure, and xfail until the next commit implements it. Changelog-None
For publicly announced channels, when --htlc-maximum-msat is not set, advertise 25% of the channel capacity (capped by what we can actually send) rather than the full capacity: a maximum well below the publicly known capacity makes probing for where payments flow much harder. Private channels, whose capacity is not public, keep the full default. Changelog-Changed: Config: public channels now default `htlc-maximum-msat` to 25% of capacity (was full capacity), for better payment privacy.
The 25% default is computed without reference to htlc_minimum_msat, so a node configured with an htlc-minimum-msat above a quarter of the channel capacity advertises a channel_update with htlc_maximum_msat below htlc_minimum_msat. Peers SHOULD ignore such a channel when routing, so the channel silently becomes unusable. Previously the default was capacity minus reserve, which made this effectively unreachable; at 25% it is not.
Floor the default at channel->htlc_minimum_msat before capping it at what we can send. A routable channel is worth more than the privacy margin the 25% default buys, and the spec makes it a MUST either way. Where htlc_minimum_msat exceeds what we can send at all, no valid value exists; log it rather than advertising an unroutable channel silently. Also route the funding_sats overflow path through the same floor and cap instead of returning early.
16fbc32 to
97384b8
Compare
|
@Andezion thanks, both of your points were real. On the first: On the second: you are right that |
|
Regenerating the RPC doc examples fails, and not cosmetically. A 500,000sat payment over a ~1M sat channel can no longer be routed at all: The cause is in u64 cap_on_capacity =
MIN(amount_msat_ratio_floor(gossmap_chan_htlc_max(c, dir), params->accuracy),
amount_msat_ratio_ceil(params->amount, params->accuracy));askrene bounds the total min-cost-flow through a channel direction by The practical effect is that this PR does not mean "each HTLC is at most 25% of capacity", it means "a channel carries at most 25% of its capacity per payment". That is what turned CI red here, rather than a handful of stale test constants. @Lagrang3, as askrene owner, could you weigh in on whether that bound is deliberate? I can see an argument for it as a conservative proxy (a flow you cannot deliver as one HTLC is not obviously deliverable as several, given Three ways forward as I see it:
I lean towards 1, with 2 as the pragmatic fallback if the flow model is not something we want to touch now. Happy to do the work either way, but I do not want to guess at askrene's intent here. Marking this as not ready until that is settled. |
|
The latest run tells a story: 53 distinct tests fail across all six integration shards, all six ASan shards and eleven of twelve valgrind shards, and nearly every one is a payment or Two details that make me think this is a shared assumption rather than one stray line:
|
|
@nGoline, we had issues in the past trying many htlcs through the same channel with a low htlc_max. |
Implements the "Oakland" privacy proposal from the Lightning Dev Summit (reaffirmed at the Vienna summit): for publicly announced channels, default the advertised
htlc_maximum_msatto 25% of channel capacity (capped by what we can actually send) when the operator has not set--htlc-maximum-msat. A maximum well below the publicly-known capacity makes probing for where payments flow significantly harder.Scope:
--htlc-maximum-msatorsetchannel.Closes #9173