Skip to content

lnrouter/lnworker: move liquidity hint update to htlc removal callbacks - #10774

Merged
SomberNight merged 2 commits into
spesmilo:masterfrom
f321x:liquidity_hint_update
Jul 29, 2026
Merged

lnrouter/lnworker: move liquidity hint update to htlc removal callbacks#10774
SomberNight merged 2 commits into
spesmilo:masterfrom
f321x:liquidity_hint_update

Conversation

@f321x

@f321x f321x commented Jul 27, 2026

Copy link
Copy Markdown
Member

Move the liquidity hint updates from the htlc log processing to the htlc removal callbacks so they
get called for all htlcs we sent out.
On master we would decrement the inflight htlc counter on the liquidity hint only for the first
successful htlc's route, after which PaymentSuccess would end the payment flow.
The remaining (successful) routes used for the other htlcs of a payment wouldn't get their counter decremented and
be penalized for this in subsequent payment attempts until the in-memory liquidity hints get reset through a restart.

f321x added 2 commits July 27, 2026 16:56
Update the channel liquidity hints in the
`htlc_fulfilled`/`htlc_failed` callbacks instead of the htlc
log handler (`_process_htlc_log()`).
`_process_htlc_log()` would raise `PaymentSuccess()` on the first fulfilled
htlc, removing the inflight htlcs counted in `LiquidityHintMgr` only for this
htlc's route.
All other htlcs that arrive later would leak and not get removed anywhere,
so the inflight htlc counter didn't get decreased and successful routes
would be punished by the penalty.
@f321x f321x added the bug 🐞 label Jul 27, 2026
@f321x
f321x marked this pull request as draft July 27, 2026 15:11
Comment thread electrum/lnworker.py
@f321x
f321x marked this pull request as ready for review July 27, 2026 15:16

@SomberNight SomberNight left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

Comment thread electrum/lnworker.py
Comment on lines -2097 to -2100
# TODO: report every route to liquidity hints for mpp
# in the case of success, we report channels of the
# route as being able to send the same amount in the future,
# as we assume to not know the capacity

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say this comment contains important information needed to understand what assumptions the liquidity hints make and should be kept (somewhere). It is no longer a TODO but it is still valuable. Could be moved to e.g. the docstring of update_liquidity_hints.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add it back in a followup.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in #10778

Comment thread electrum/lnworker.py
@SomberNight
SomberNight merged commit f190c9f into spesmilo:master Jul 29, 2026
11 checks passed
@f321x
f321x deleted the liquidity_hint_update branch July 29, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants