clboss/contrib
Ken Sedgwick 262afe82ef
Some checks failed
Code Base Sanity Check / tests (push) Has been cancelled
Code Base Sanity Check / coverage (push) Has been cancelled
Code Base Sanity Check / build-clang (push) Has been cancelled
contrib: cln-plugin-bounce picks up config edits on restart
lightningd parses its config files once, at its own startup; a
dynamic "plugin start" hands the plugin the option values memorized
back then, so bouncing a plugin after a config edit silently
restarted it on stale settings.

Snapshot listconfigs before stopping anything to learn which
options belong to each bounced plugin and which config files
lightningd actually loaded (main, network, includes,
config.setconfig), then re-read those files and compare each
plugin's current file values against its running values.

The restart is two-phase because "plugin start" with option
parameters segfaults lightningd through at least v26.04 whenever a
configvar names an unregistered option -- precisely the state while
a sibling plugin is stopped (configvar_finalize_overrides
dereferences opt_find_long() without a NULL check; fix pending as
"setconfig: fix crash when a configvar outlives its plugin
option").  Phase one is the classic bounce -- ordered stops,
reverse bare starts -- which cannot trip the bug.  Phase two, only
for plugins whose file values differ, stops and restarts each such
plugin alone with its file options passed in keyword form on the
"plugin start" line, while every other plugin is up.  With no
edits pending the bounce is exactly the classic single pass.  As a
final guard, the apply phase is refused with a warning when any
option named in the config files is unregistered (e.g. a plugin
stopped by hand), and an optioned start that is rejected degrades
to a bare restart with a warning: a running plugin on stale values
beats a stopped one.

Field note: the first, single-phase version of this change crashed
prod1's lightningd (v26.04.1) through exactly this path --
plugin_add_params -> configvar_finalize_overrides -- a second
reproduction route for the pending fix, needing no version skew,
just a multi-plugin bounce with a pending config edit.
2026-08-07 12:56:46 -07:00
..
clboss contrib: add --lightning-dir option 2024-10-18 13:36:46 -05:00
clboss-askrene-layer-summary askrene-migration: contrib script robustness + de-flake coalesce test 2026-08-04 11:01:52 -07:00
clboss-earnings-history contrib: modify #271 to work on both old and new python versions 2025-10-07 11:21:38 -07:00
clboss-forwarding-stats ChannelCreator: fund candidates in track-record tier order 2026-08-04 11:02:15 -07:00
clboss-recent-earnings contrib: add --lightning-dir option 2024-10-18 13:36:46 -05:00
clboss-routing-stats add --days option to clboss-routing-stats 2025-08-22 12:19:00 -07:00
clboss-xrebalance-survey contrib: clboss-xrebalance-survey, the prediction-bucket census 2026-08-04 11:02:05 -07:00
clboss-xrebalance-survival contrib: clboss-xrebalance-survival, calibrate sampling rates from evidence 2026-08-04 11:02:06 -07:00
clboss-xrebalance-view XRebalancer: request the full matched volume 2026-08-04 12:39:51 -07:00
cln-plugin-bounce contrib: cln-plugin-bounce picks up config edits on restart 2026-08-07 12:56:46 -07:00
fee-log-parser contrib: add debug log post-processor and plotting utilities for fee algos 2026-02-27 12:58:15 -08:00
feemon-validate contrib: increase feemon-validate timestamp tolerance 2026-02-27 14:28:59 -08:00
feemon_data.py contrib: use clboss-feemon-peers to make aggregate plots 2026-02-27 14:29:00 -08:00
plot-aggregate contrib: use clboss-feemon-peers to make aggregate plots 2026-02-27 14:29:00 -08:00
plot-balance-price contrib: add fee modder analysis utilities: 2026-02-27 14:21:44 -08:00
plot-fees contrib: default plot-fees/plot-aggregate to API-only, keep legacy DB optional 2026-02-27 14:28:58 -08:00
plot-size-balance contrib: add fee modder analysis utilities: 2026-02-27 14:21:44 -08:00
plot-size-price contrib: add fee modder analysis utilities: 2026-02-27 14:21:44 -08:00
poetry.lock update poetry config for new deps 2025-08-22 12:19:00 -07:00
pyproject.toml update poetry config for new deps 2025-08-22 12:19:00 -07:00
README.md contrib: add cln-plugin-bounce 2026-08-04 11:02:22 -07:00
recently-closed contrib/recently-closed: support --lightning-dir and network args; fix broken imports 2026-08-04 11:01:38 -07:00
sys_stats_report Modify sys_stats_report to append fee data from clboss-feerates 2025-08-22 12:20:18 -07:00

Contributed CLBOSS Utilities

Installing

There are two ways to install the requirements:

  • poetry
  • nix

Poetry

There are two ways to install poetry:

  • pipx
  • official installer

Pipx

# Install pipx
sudo apt update
sudo apt install pipx
pipx install poetry

Or, click here for the official installer

Once poetry is installed, install the Python dependencies:

# The following commands need to be run as the user who will be running
# the clboss utility commands (connecting to the CLN RPC port)

# Install clboss contrib utilities
poetry shell
poetry install

Nix

If you have nix, you can just do, from the project root:

nix-shell contrib-shell.nix

Then before running the commands below, be sure to do:

cd contrib/

Running

./clboss-earnings-history

./clboss-recent-earnings

./clboss-routing-stats

./clboss-forwarding-stats

./recently-closed

./clboss-askrene-layer-summary

./cln-plugin-bounce <plugin-name>...

The `clboss-routing-stats` and `clboss-forwarding-stats` scripts now accept `--days` to limit
how many days of earnings history are considered when ranking channels.

Script Details

  • clboss-earnings-history now supports additional options:
    • --csv-file <file> writes the raw earnings data as CSV.
    • --graph-file <file> generates a PNG plot of net earnings.
    • --bucket lets you aggregate by day, week, fortnight, month, or quarter.
  • clboss-forwarding-stats summarizes channel forwarding data and can be restricted with --days.
  • clboss-routing-stats ranks peers using recent earnings data and also accepts the --days option.
  • recently-closed lists channels that closed within the last N days, also controlled via --days.
  • clboss-askrene-layer-summary rolls an askrene layer's raw constraint dump up into a breadth/depth census: how many distinct channel-directions the layer knows about and how many constraint entries are stacked on each, with --top N resolving the busiest directions to node aliases. Works on any persistent layer (clboss by default) and can replay a captured askrene-listlayers dump offline via --input.
  • cln-plugin-bounce stops and restarts running plugins without restarting lightningd. plugin stop needs a plugin's exact registered name, which for versioned installs includes the version string; the script looks each one up from plugin list, stops the named plugins in the order given, and starts them again in reverse order, so the list order encodes any shutdown dependency between them. Restarts use the unversioned sibling path when one exists (usually a symlink maintained by the install script), so a repointed symlink brings up the new version. Plugin names are the arguments not starting with -; every other argument is passed to lightning-cli (e.g. --signet --lightning-dir=...), so names and options may appear in any order. Plain POSIX sh plus jq, so unlike a shell alias it also works under sudo.
  • fee-log-parser is a parser that streams DEBUG-level logging and writes a sqlite database containing fee algorithm information. CLBOSS now records the same schema in its internal database (data.clboss, tables feemon_peers and feemon_change_events) during normal operation.
  • clboss-feemon-history is a CLBOSS command that returns per-peer fee modifier history between optional since/before timestamps.
  • clboss-feemon-peers is a CLBOSS command that returns peer nodeids with fee monitor history between optional since/before timestamps.
  • feemon-validate compares fee-log-parser sqlite history against clboss-feemon-history per peer over a requested time window. It reports per-peer progress, prints compact timestamp diagnostics for missing/extra records, prints full-record diagnostics for field mismatches, and exits non-zero when discrepancies are found. Default external DB path is ./clboss-fee-info.sqlite3 and default timestamp tolerance is 60 seconds. Default float tolerance is 1e-5 and is scaled by value magnitude (tol * max(1, |a|, |b|)) to avoid false mismatches from JSON float rendering precision (notably mult_product). Derived integer fields est_base and est_ppm use a relative tolerance with default 1e-3 (--int-rel-tolerance) so small rounding effects at large magnitudes do not trigger mismatches. --since/--before accept Unix epoch seconds in addition to the existing human-readable time formats. Naive timestamps are interpreted in local time; Unix epoch input is UTC; explicit timezone offsets are honored.
  • plot-fees plots fee-related time series for a peer from merged fee monitor data: API history (clboss-feemon-history) plus legacy sqlite history (fee-log-parser). When both sources cover a period, API records are preferred and sqlite is used only for earlier history. By default it uses API data only; pass --db to include legacy sqlite history. --peer accepts a nodeid, alias (via lightning-cli/listnodes), or SCID (via lightning-cli/listpeerchannels). The combo view includes a daily earnings panel (incoming/outgoing msat per day) when lightning-cli is available, and the incoming-earnings/outgoing-earnings views render those panels on their own. In the theory panel, a theory_center line is drawn only where API records include price_center; legacy-only spans omit that line. Use --title to override the plot title (defaults to the peer label; pass empty to omit).
  • plot-aggregate plots aggregate percentile summaries from merged fee monitor data (API preferred over overlapping legacy sqlite history). By default it uses API data only; pass --db to include legacy sqlite history. Views include baseline-base, baseline-ppm, size, balance, theory, advertised-base, advertised-ppm, earnings, and a combo view. Each view shows daily p00/p10/p25/p50/p75/p90/p100 percentiles across nodes. The earnings view uses clboss-earnings-history all to compute net earnings percentiles (sat/day). In API mode, peer discovery uses clboss-feemon-peers [since] [before] so windowed aggregate plots include peers that were active during the selected period (even if currently closed).