mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-13 12:33:20 +02:00
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. |
||
|---|---|---|
| .. | ||
| clboss | ||
| clboss-askrene-layer-summary | ||
| clboss-earnings-history | ||
| clboss-forwarding-stats | ||
| clboss-recent-earnings | ||
| clboss-routing-stats | ||
| clboss-xrebalance-survey | ||
| clboss-xrebalance-survival | ||
| clboss-xrebalance-view | ||
| cln-plugin-bounce | ||
| fee-log-parser | ||
| feemon-validate | ||
| feemon_data.py | ||
| plot-aggregate | ||
| plot-balance-price | ||
| plot-fees | ||
| plot-size-balance | ||
| plot-size-price | ||
| poetry.lock | ||
| pyproject.toml | ||
| README.md | ||
| recently-closed | ||
| sys_stats_report | ||
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-historynow supports additional options:--csv-file <file>writes the raw earnings data as CSV.--graph-file <file>generates a PNG plot of net earnings.--bucketlets you aggregate byday,week,fortnight,month, orquarter.
clboss-forwarding-statssummarizes channel forwarding data and can be restricted with--days.clboss-routing-statsranks peers using recent earnings data and also accepts the--daysoption.recently-closedlists channels that closed within the last N days, also controlled via--days.clboss-askrene-layer-summaryrolls 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 Nresolving the busiest directions to node aliases. Works on any persistent layer (clbossby default) and can replay a capturedaskrene-listlayersdump offline via--input.cln-plugin-bouncestops and restarts running plugins without restartinglightningd.plugin stopneeds a plugin's exact registered name, which for versioned installs includes the version string; the script looks each one up fromplugin 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 tolightning-cli(e.g.--signet --lightning-dir=...), so names and options may appear in any order. Plain POSIX sh plusjq, so unlike a shell alias it also works undersudo.fee-log-parseris 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, tablesfeemon_peersandfeemon_change_events) during normal operation.clboss-feemon-historyis a CLBOSS command that returns per-peer fee modifier history between optionalsince/beforetimestamps.clboss-feemon-peersis a CLBOSS command that returns peer nodeids with fee monitor history between optionalsince/beforetimestamps.feemon-validatecomparesfee-log-parsersqlite history againstclboss-feemon-historyper 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.sqlite3and default timestamp tolerance is 60 seconds. Default float tolerance is1e-5and is scaled by value magnitude (tol * max(1, |a|, |b|)) to avoid false mismatches from JSON float rendering precision (notablymult_product). Derived integer fieldsest_baseandest_ppmuse a relative tolerance with default1e-3(--int-rel-tolerance) so small rounding effects at large magnitudes do not trigger mismatches.--since/--beforeaccept 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-feesplots 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--dbto include legacy sqlite history.--peeraccepts 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 theincoming-earnings/outgoing-earningsviews render those panels on their own. In thetheorypanel, atheory_centerline is drawn only where API records includeprice_center; legacy-only spans omit that line. Use--titleto override the plot title (defaults to the peer label; pass empty to omit).plot-aggregateplots aggregate percentile summaries from merged fee monitor data (API preferred over overlapping legacy sqlite history). By default it uses API data only; pass--dbto include legacy sqlite history. Views includebaseline-base,baseline-ppm,size,balance,theory,advertised-base,advertised-ppm,earnings, and acomboview. Each view shows daily p00/p10/p25/p50/p75/p90/p100 percentiles across nodes. Theearningsview usesclboss-earnings-history allto compute net earnings percentiles (sat/day). In API mode, peer discovery usesclboss-feemon-peers [since] [before]so windowed aggregate plots include peers that were active during the selected period (even if currently closed).