Commit graph

88 commits

Author SHA1 Message Date
Ken Sedgwick
7fa87c01e7
XMoveFunds: age the clboss-xrebalance layer, runtime-tunable via setconfig
Adds periodic askrene-age against the persistent clboss-xrebalance
layer so capacity constraints written by inform_channel_constrained
do not accumulate forever.  Mirrors FundsMover's age_clboss_layer:
fires on Msg::TimerRandomHourly, logs num_removed at Debug, and
catches RpcError with -32601 stayed at Debug (graceful degradation
on CLN without askrene-age) while other codes promote to Warn so
sustained aging failure is visible.

The aging cutoff is controlled by a new plugin option,
clboss-xrebalance-age-secs, default 3600 (1h) to match FundsMover's
production value.  Operators on networks with slower flows (signet)
are expected to widen this; the right value is empirical and will
be tuned after observation.

The option is registered dynamic=true so the window is mutable at
runtime via:

  lightning-cli setconfig clboss-xrebalance-age-secs <secs>

No clboss / lightningd restart required.

To support that, three small infrastructure pieces:

  * Boss::Msg::ManifestOption gains a bool dynamic field (default
    false; preserves existing behavior).

  * 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
    flag) from Msg::ManifestOption events, then handles incoming
    Msg::CommandRequest where command == "setconfig" by validating
    the named option is registered + dynamic and re-raising a fresh
    Msg::Option on the bus.  Existing option handlers re-apply the
    new value transparently.

Contract for any future opt-in to dynamic: at startup lightningd
encodes Int / Bool / Flag option values as JSON primitives, but at
setconfig time it encodes them as JSON strings.  Handlers for
dynamic options must accept both Jsmn shapes.  The XMoveFunds
option handler does this; the contract is documented in
SetConfigHandler's header comment so future modules can opt in
safely.
2026-06-01 09:50:46 -07:00
Ken Sedgwick
e2dc3c35dc
XMoveFunds: scaffold the manual-trigger rebalance primitive
Some checks are pending
Code Base Sanity Check / tests (push) Waiting to run
Code Base Sanity Check / coverage (push) Waiting to run
Code Base Sanity Check / build-clang (push) Waiting to run
Adds Boss/Mod/XMoveFunds/Main.{hpp,cpp} and registers a new RPC
command `clboss-xmovefunds`.  This is the lowest-level primitive
that the upcoming xrebalance algorithm will sit on top of: the
caller hands it an explicit set of source channels (drain
candidates), destination channels (fill candidates), an amount,
and optional knobs, and the module will eventually drive an
askrene-getroutes call (circular mode) and an optional sendpay.

The module follows the pimpl + Impl pattern already used by
FundsMover and is installed in Boss/Mod/all.cpp alongside the
existing rebalance machinery.

API surface

Each of source_scid and dest_scid may be either a single scid
string or a JSON array of scid strings.  The single-channel form
is convenient for hand-typed RPC calls; the array form is what
the xrebalance algorithm will use to express multi-source /
multi-dest tier selection.  parse_scid_list() in the
implementation handles both shapes uniformly.

Named parameters:

  source_scid    scid string or array -- channels whose us->peer
                 direction stays unmasked.  Required.
  dest_scid      scid string or array -- channels whose peer->us
                 direction stays unmasked.  Required.
  amount_msat    integer -- total amount to move.  Required.
  maxfee_msat    integer.  Defaults to 5000 ppm of amount_msat,
                 floored at 1000 msat.
  maxparts       integer.  Defaults to 10.
  execute        boolean.  Defaults to false; when false, the
                 route is computed and reported but not sent.

The manifest help text spells out the array shape with concrete
examples so anyone running `lightning-cli help clboss-xmovefunds`
sees the full surface without having to read the code.
2026-05-31 14:10:56 -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
ZmnSCPxj jxPCSnmZ
98f89cca76 Boss/Mod/NewaddrHandler.cpp: Module to perform newaddr commands. 2020-09-28 16:17:47 +08:00