Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple improvements #115

Merged
merged 17 commits into from
Jul 4, 2024
Merged

Conversation

feelancer21
Copy link
Contributor

I added multiple improvements to charge-lnd. Below a summary of the commits. Feel free to test, comment or merge.

Fixes also #111, #83 and #2

Functional Improvements

  • Rules based on pending htlcs

    We include rules based on either the number of pending HTLCs or the
    next expiry.

  • Introducing: inbound_level_ppm and min_inbound_fee_ppm_delta

    1. min_inbound_fee_ppm_delta is the necessary minimum change in the
      inbound_fee_ppm. The parameter uses min_fee_ppm_delta as the default.
    2. We also ensure that the inbound fee rates are only changed if the
      change is sufficiently large.
    3. If inbound_level_ppm is set, inbound_fee_ppm is calculated
      with min(inbound_level_ppm - fee_ppm; 0).
  • Consideration of the local constraints during channel update

    Local constraints are used to floor/cap the min_htlc_mat/max_htlc_msat.

  • Consideration of the commit fee in the balance calculation

    We take the commit fee into account when calculating the local balance
    and the remote balance, depending on who opened the channel. This
    stabilizes the calculation of balances and ratios in times of volatile
    onchain fees.

  • Consideration of the unsettled balance

    We add the amounts of pending htlcs to the local and remote balance of
    a channel. Incoming htlcs are added to the remote balance and outgoing
    htlcs to the local balance.

  • Add an onchain matcher

    The onchain matcher offers the possibility to enforce policies
    depending on the current onchain fees. The confirmation target
    can be configured by the user (default: 6).

  • Circuitbreaker support

    It is now possible to control the node limits of a circuitbreaker
    instance dynamically.

Logging

  • Printing RpcErrors and UpdateFailures

  • Very verbose mode

    In this new mode we print more information than in verbose mode.
    Every matched policy is printed. That can be useful if one use a
    config with many non final policies.

Others

  • Matchers are now only called once

    Until now, it could happen with several attributes that the matcher
    for a namespace was called several times unnecessarily.

  • use onchain fee estimate of lnd instead of electrum

    We are using the onchain fee estimator of lnd now. Internally, lnd uses
    either bitcoind or a fee url for the estimation.

  • Cleanup unused module imports

@feelancer21 feelancer21 force-pushed the features-all branch 2 times, most recently from 0fc7ff1 to b825c79 Compare June 8, 2024 10:04
We are using the onchain fee estimator of lnd now. Internally, lnd uses
either bitcoind or a fee url for the estimation.
It is now possible to control the node limits of a circuitbreaker
instance dynamically.
The onchain matcher offers the possibility to enforce policies
depending on the current onchain fees. The confirmation target
can be configured by the user (default: 6).
Add synced_to_chain as a criterion to the onchain matcher.
synced_to_chain becomes false if LND is not synced to the
chain for more than 5 minutes. In the past, this was an
indicator of a severe issue that required a hotfix for lnd.
We add the amounts of pending htlcs to the local and remote balance of
a channel. Incoming htlcs are added to the remote balance and outgoing
htlcs to the local balance.
We take the commit fee into account when calculating the local balance
and the remote balance, depending on who opened the channel. This
stabilizes the calculation of balances and ratios in times of volatile
onchain fees.
We include rules based on either the number of pending HTLCs or the
next expiry.
Local constraints are used to floor/cap the min_htlc_mat/max_htlc_msat.
Until now, it could happen with several attributes that the matcher
for a namespace was called several times unnecessarily.
1) `min_inbound_fee_ppm_delta` is the necessary minimum change in the
   inbound_fee_ppm. The parameter uses `min_fee_ppm_delta` as the default.
2) We also ensure that the inbound fee rates are only changed if the
   change is sufficiently large.
3) If `inbound_level_ppm` is set, `inbound_fee_ppm` is calculated
   with `min(inbound_level_ppm - fee_ppm; 0)`.
In this new mode we print more information than in verbose mode.
Every matched policy is printed. That can be useful if one use a
config with many non final policies.
@feelancer21
Copy link
Contributor Author

Rebased because of #116

@accumulator accumulator merged commit 7224e51 into accumulator:master Jul 4, 2024
@accumulator
Copy link
Owner

huge improvements @feelancer21, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants