Commit graph

89 commits

Author SHA1 Message Date
Ken Sedgwick
feec8ddcb5
AskreneUpdates: SQL-backed store + per-request layer projection
Add AskreneUpdates, a standalone module both rebalancers will use to hold the
node disables and channel_update overrides they learn from routing failures.
askrene never ages these (they carry no timestamp, unlike the inform-channel
constraints), so instead of accumulating them in a shared askrene layer they
live in two append-only sqlite tables here and are projected, still-fresh, into
a private per-request layer for each getroutes.

Records arrive as AskreneNodeDisableUpdate / AskreneChannelUpdate. A ReqResp
(Request/ResponseAskreneUpdates) returns the distinct nodes disabled within
clboss-node-disable-age-secs and the latest override per channel direction
within clboss-channel-update-age-secs. Static open_layer/close_layer build and
tear down a uuid-named, non-persistent layer from a response (open_layer returns
an empty name if askrene is absent, so a caller never names a missing layer).
Rows are pruned only at clboss-update-retain-secs (default 30d), so the log
survives long enough to mine. Nothing calls the module yet.

Also add an AskreneLayer header comment pointing at this store for where
the learned node disables and channel_update overrides live.
2026-08-04 11:01:52 -07:00
Ken Sedgwick
e00758aac3
Add rebalancer mode selector (classic/off) as a dynamic option
Introduces a single source of truth for which rebalancing track is
active.  Boss::Mod::RebalanceModeManager owns the mode in memory (no
sqlite, so a restart reverts to the configured default, giving a
known-good baseline on every boot) and registers clboss-rebalance-mode
as a dynamic option: the config file sets the startup default and
`setconfig clboss-rebalance-mode <mode>` switches it at runtime without
a restart.  It answers RequestRebalanceMode queries and reports the mode
under clboss-status.

Modes are "classic" (run the rebalancer) and "off" (a real quiesce,
also the supported way to disable rebalancing entirely).  This is the
seam that later lets a second rebalancing track coexist and be toggled
without a restart.

The classic-track rebalancers self-gate on the mode at their existing
decision points, modeled on RebalanceUnmanager: EarningsRebalancer gates
its trigger, InitialRebalancer gates its run, and JitRebalancer gates
the top of htlc_accepted so that in off mode it does not defer the HTLC
and adds no forwarding latency.  A header-only Boss::ModG::
RebalanceModeProxy provides get_mode for the gate sites.  off composes
with the existing per-peer unmanage balance tag: off wins globally,
otherwise the per-peer tag still excludes specific peers.

The three rebalancers' unit tests now install a RebalanceModeManager on
the test bus so the self-gate query is answered (default classic, so
they behave as before).  Without a responder the RequestRebalanceMode
ReqResp is never satisfied and leaks, which the valgrind-checked tests
flag as a failure.

New files: Boss/RebalanceMode.hpp, Boss/Msg/RequestRebalanceMode.hpp,
Boss/Msg/ResponseRebalanceMode.hpp, Boss/ModG/RebalanceModeProxy.hpp,
Boss/Mod/RebalanceModeManager.{hpp,cpp}.
2026-08-04 11:01:46 -07:00
Ken Sedgwick
30316f4f73
Add dynamic (setconfig-tunable) plugin option infrastructure
Introduces the mechanism for runtime-mutable plugin options: an option
marked dynamic can be changed via `lightning-cli setconfig <name> <val>`
without restarting clboss or lightningd.  No option opts in yet -- this
is the foundation (the rebalancer mode selector is the first consumer).

  - Boss::Msg::ManifestOption gains a bool dynamic field (default false,
    preserving the existing startup-only contract).
  - Boss::Mod::Manifester emits the per-option dynamic flag in the
    getmanifest response, so lightningd knows to forward setconfig for
    that option.
  - New Boss::Mod::SetConfigHandler module records (name -> dynamic)
    from Msg::ManifestOption events, then handles incoming setconfig
    CommandRequests: it validates the named option is registered and
    dynamic, and re-raises a fresh Msg::Option on the bus, so existing
    option handlers re-apply the new value transparently.

Because Msg::Option is now re-emitted at runtime (not only during init),
subscribers must filter by name and tolerate post-init arrival.
AmountSettingsHandler gains an `if (!settings) return` guard: it moves
`settings` away at EndOfOptions, so a later Msg::Option for an unrelated
name must be dropped -- this also fixes a latent assert(settings) crash
that any post-EndOfOptions Msg::Option would have tripped.

Contract documented in SetConfigHandler.hpp: lightningd delivers
Int/Bool/Flag option values as JSON primitives at startup but as JSON
strings at setconfig time, so dynamic-option handlers must accept both
Jsmn shapes.
2026-08-04 11:01:46 -07:00
Ken Sedgwick
ed16c670bc
feemon: add fee monitor to save per-channel stats
- add clboss-feemon-history command
- add unit tests
2026-02-27 14:28:53 -08:00
ZmnSCPxj jxPCSnmZ
88702eac07 Boss/Mod/PeerFromScidMapper.cpp: Module to centralize getting peer node IDs from SCIDs. 2023-07-11 20:57:51 +08:00
ZmnSCPxj jxPCSnmZ
56b43bc8e3 Boss/Mod/all.cpp: Disable InitialRebalancer, as it is not based on economic rationality. 2022-05-11 12:46:27 +00:00
ZmnSCPxj jxPCSnmZ
42b8c967ad Boss/Mod/RebalanceUnmanager.cpp: Module to keep track of nodes that must not be managed for rebalancing. 2022-05-11 12:09:13 +00:00
ZmnSCPxj jxPCSnmZ
ddc4c707d8 Boss/Mod/AvailableRpcCommandsAnnouncer.cpp: New module to announce the commands found on this node.
This will allow CLBOSS to figure out what commands (and parameters) the
specific C-Lightning node being managed has, and adapt accordingly.
2022-05-04 00:34:22 +00:00
ZmnSCPxj jxPCSnmZ
471f68b1e7 Boss/Mod/RpcWrapper.cpp: Add new module for wrapping the RPC interface into one for the S::Bus. 2022-05-02 05:15:18 +00:00
ZmnSCPxj jxPCSnmZ
a499d41a31 Boss/Mod/all.cpp: Actuall instantiate AmountSettingsHandler. 2022-04-25 10:01:46 +00:00
ZmnSCPxj jxPCSnmZ
f84270873c Boss/Mod/ListfundsAnalyzer.cpp: Module to analyze result of listfunds command. 2022-04-21 12:30:29 +08:00
ZmnSCPxj jxPCSnmZ
54af2785c4 Boss/Mod/SwapReporter.cpp: New module to provide report on swaps. 2021-11-27 12:53:05 +00:00
ZmnSCPxj jxPCSnmZ
40bc968b42 Boss/Mod/all.cpp: Disable ComplainerByLowSuccessPerDay.
The module kinda sucks I think.
2021-05-29 07:56:35 +08:00
ZmnSCPxj jxPCSnmZ
9ffc48081d Boss/Mod/PaymentDeleter.cpp: Generalized deleter of probe and funds-movement payments. 2021-04-28 19:02:31 +08:00
ZmnSCPxj jxPCSnmZ
04dfdda219 Boss/Mod/FeeModderByPriceTheory.cpp: Initial cut at price theory. 2021-04-18 18:43:48 +08:00
ZmnSCPxj jxPCSnmZ
62383183c0 Boss/Mod/ComplainerByLowSuccessPerDay.cpp: Complain about peers with low success-per-day metric. 2021-04-09 11:01:56 +08:00
ZmnSCPxj jxPCSnmZ
e2de82d726 Boss/Mod/ComplainerByLowConnectRate.cpp: Complain about low peer uptime. 2021-04-09 11:01:56 +08:00
ZmnSCPxj jxPCSnmZ
f329089a64 Boss/Mod/PeerComplaintsDesk/Recorder.cpp: Sub-module to record complaints in our database. 2021-04-08 18:08:45 +08:00
ZmnSCPxj jxPCSnmZ
06a40afa14 Boss/Mod/UnmanagedManager.cpp: Module to suppress automatic management. 2021-03-01 17:17:12 +08:00
ZmnSCPxj jxPCSnmZ
adb478ee37 Boss/Mod/SelfUptimeMonitor.cpp: Module to track our own uptime. 2021-02-09 15:51:36 +08:00
ZmnSCPxj jxPCSnmZ
12a8794518 Boss/Msg/TimerTwiceDaily.hpp: Emitted twice a day. 2021-01-25 10:54:39 +08:00
ZmnSCPxj jxPCSnmZ
7a276e7f53 Boss/Mod/EarningsRebalancer.cpp: Rebalancer based on earnings. 2021-01-13 10:15:37 +08:00
ZmnSCPxj jxPCSnmZ
0fa7d2bc70 Boss/Mod/OnchainFundsIgnorer.cpp: Module to provide a flag for ignoring or noticing onchain funds. 2020-11-20 00:11:38 +08:00
ZmnSCPxj jxPCSnmZ
6c714cb36b Boss/Mod/ChannelFinderByEarnedFee.cpp: Module to propose channels to peers of peers which have earned us high fees.
Closes: #7
2020-11-13 10:26:25 +08:00
ZmnSCPxj jxPCSnmZ
7732e9d248 Boss/Mod/InitialRebalancer.cpp: Module to rebalance channels that are heavily owned by us. 2020-10-26 11:31:33 +08:00
ZmnSCPxj jxPCSnmZ
830f258acf Boss/Mod/JitRebalancer.cpp: Implement JIT rebalancing. 2020-10-25 10:17:48 +08:00
ZmnSCPxj jxPCSnmZ
0aad85d430 Boss/Mod/EarningsTracker.cpp: Module to keep track of fee earnings, for use with rebalancing decisions. 2020-10-23 23:48:07 +08:00
ZmnSCPxj jxPCSnmZ
e2d642fb53 Boss/Mod/MoveFundsCommand.cpp: Temporary debugging command to check funds mover. 2020-10-22 11:38:47 +08:00
ZmnSCPxj jxPCSnmZ
7a9fe45655 Boss/Mod/FundsMover/Main.cpp: Finish packaging up funds mover module. 2020-10-22 08:48:09 +08:00
ZmnSCPxj jxPCSnmZ
5a14a7e340 Boss/Mod/FeeModderByBalance.cpp: Passive balancing by fee manipulation. 2020-10-16 21:54:17 +08:00
ZmnSCPxj jxPCSnmZ
44b7da78fe Boss/Mod/FeeModderBySize.cpp: Modify our fees according to our size relative to other nodes. 2020-10-14 17:33:14 +08:00
ZmnSCPxj jxPCSnmZ
86e96a107f Boss/Mod/ChannelCreateDestroyMonitor.cpp: Module to monitor channel creation and destruction events. 2020-10-13 15:53:44 +08:00
ZmnSCPxj jxPCSnmZ
c39c641e05 Boss/Mod/Dowser.cpp: Move dowser to its own separate module. 2020-10-12 15:19:31 +08:00
ZmnSCPxj jxPCSnmZ
964353a67a Boss/Mod/RegularActiveProbe.cpp: Trigger for ActiveProber. 2020-10-07 16:08:09 +08:00
ZmnSCPxj jxPCSnmZ
9dc12b6068 Boss/Mod/ActiveProber.cpp: active probing module. 2020-10-07 15:06:38 +08:00
ZmnSCPxj jxPCSnmZ
12d27ec250 Boss/Mod/PeerMetrician.cpp: Add metrics generator. 2020-10-06 15:38:13 +08:00
ZmnSCPxj jxPCSnmZ
6706d547e0 Boss/Mod/PeerStatistician.cpp: Stores statistics. 2020-10-06 13:26:09 +08:00
ZmnSCPxj jxPCSnmZ
354ee0aa75 Boss/Mod/ForwardFeeMonitor.cpp: Module to track successful forwards. 2020-10-05 16:30:52 +08:00
ZmnSCPxj jxPCSnmZ
deb35dcf3d Boss/Mod/SendpayResultMonitor.cpp: Module to monitor our sendpay/sendonion. 2020-10-04 23:22:17 +08:00
ZmnSCPxj jxPCSnmZ
20ec2779d2 Boss/Mod/HtlcAcceptor.cpp: Module to handle and dispatch HTLC acceptance. 2020-10-03 18:49:27 +08:00
ZmnSCPxj jxPCSnmZ
2207157461 Boss/Mod/ChannelFinderByDistance.cpp: Defer finding while local channels are inactive. 2020-10-02 15:54:57 +08:00
ZmnSCPxj jxPCSnmZ
11b508009d Boss/Mod/ChannelFinderByDistance.cpp: Finds nodes by distance from yourself. 2020-10-02 15:05:39 +08:00
ZmnSCPxj jxPCSnmZ
beae941401 Boss/Mod/ChannelFinderByListpays.cpp: Module to propose channels according to results of listpays. 2020-10-01 17:09:39 +08:00
ZmnSCPxj jxPCSnmZ
bf1e00b127 Boss/Mod/ChannelCandidateMatchmaker.cpp: Module to figure out patrons of patronless channel candidates. 2020-10-01 14:54:42 +08:00
ZmnSCPxj jxPCSnmZ
090467ea3c Boss/Mod/ChannelFeeManager.cpp: Module to consider other modules for modifying the channel fee settings. 2020-09-30 15:49:45 +08:00
ZmnSCPxj jxPCSnmZ
a7e41fda32 Boss/Mod/ChannelFeeSetter.cpp: Module to change channel fees. 2020-09-30 15:26:28 +08:00
ZmnSCPxj jxPCSnmZ
2f39ac12ea Boss/Mod/PeerCompetitorFeeMonitor/: Module to determine channel fees going into our peers. 2020-09-30 13:30:58 +08:00
ZmnSCPxj jxPCSnmZ
123b78110a Boss/Mod/NodeBalanceSwapper.cpp: Module to get incoming capacity. 2020-09-30 09:56:58 +08:00
ZmnSCPxj jxPCSnmZ
f42ede0b79 Boss/Mod/NeedsOnchainFundsSwapper.cpp: Swap when we need more funds onchain. 2020-09-29 14:51:19 +08:00
ZmnSCPxj jxPCSnmZ
2492249527 Boss/Mod/SwapManager.cpp: Offchain-to-onchain swap manager. 2020-09-29 08:17:33 +08:00