Commit graph

20 commits

Author SHA1 Message Date
Ken Sedgwick
cbdbae2be1
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-06-23 14:12:03 -07:00
Ken Sedgwick
ec4d695796 Reduce the default max-rebalance-fee-ppm 2025-08-25 09:30:52 -07:00
Ken Sedgwick
30c7be4019 Add configurable max rebalance fee (ppm)
Introduce `--clboss-max-rebalance-fee-ppm` to cap the fee allowed for a
single rebalance. Both JitRebalancer and EarningsRebalancer register and
use this option, defaulting to 5000 ppm (0.5%). Documentation updated to
explain the new setting.
2025-08-25 09:30:52 -07:00
Ken Sedgwick
52e739ebd9 tabify for consistency (unfortunately) 2025-08-25 09:30:52 -07:00
Ken Sedgwick
4a2ea4a039 Insert exception what() value in logging messages 2024-08-19 15:04:30 -07:00
Ken Sedgwick
dec8114cdf Convert some listpeers uses to listpeerchannels.
A couple `listpeers` uses can remain because they don't need channel
information.  Others use ListpeersAnnouncer and are covered by the
next commit.
2024-06-02 16:19:56 -07:00
Ken Sedgwick
60c07a7d66 Handle JSON-RPC msat amounts in either the old or new conventions 2023-08-18 20:29:21 -07:00
Ken Sedgwick
78c39f6242 Fix build issue w/ htlc_accepted_cont signature 2023-08-18 12:34:08 -07:00
ZmnSCPxj jxPCSnmZ
b2def4c51e Boss/Msg/ReqRespTraits.hpp: Use a traits class for requests and response. 2023-07-11 20:57:51 +08:00
ZmnSCPxj jxPCSnmZ
7f1db47af3 Boss/Mod/JitRebalancer.cpp: Use the new PeerFromScidMapper module. 2023-07-11 20:57:51 +08:00
ZmnSCPxj jxPCSnmZ
64ca360f65 *: Use Ln::CommandId for command IDs for received commands and hook events. 2022-11-23 00:36:43 +08:00
ZmnSCPxj jxPCSnmZ
c8ddb962df Boss/Mod/JitRebalancer.cpp: Respect unmanagement. 2022-05-11 12:09:13 +00:00
ZmnSCPxj jxPCSnmZ
773872435b Boss/Mod/JitRebalancer.cpp: Make testable via RPC emulation, also write a test. 2022-05-11 12:09:13 +00:00
ZmnSCPxj jxPCSnmZ
a9d0ad9b18 Boss/Mod/: Use iterators instead of indexing for Jsmn::Object types.
Closes: #28
2020-11-18 16:46:20 +08:00
ZmnSCPxj jxPCSnmZ
366229d7d7 Boss/Mod/JitRebalancer.cpp: Fix traversal of channels. 2020-11-06 10:03:49 +08:00
ZmnSCPxj jxPCSnmZ
41bd7bc6af *: Silence clang warnings. 2020-11-02 19:02:35 +08:00
ZmnSCPxj jxPCSnmZ
0bbf9426de Boss/Mod/JitRebalancer.cpp: Scale limit on rebalancing fee according to size of rebalance. 2020-10-28 12:29:13 +08:00
ZmnSCPxj jxPCSnmZ
91e1aa9eb9 Boss/Mod/InitialRebalancer.cpp, Boss/Mod/JitRebalancer.cpp: Make sure ReqResp objects are on persistent objects. 2020-10-28 08:35:08 +08:00
ZmnSCPxj jxPCSnmZ
c2311cc9d4 Boss/Mod/InitialRebalancer.cpp, Boss/Mod/JitRebalancer.cpp: Increase limits on rebalancing fees. 2020-10-27 21:40:28 +08:00
ZmnSCPxj jxPCSnmZ
830f258acf Boss/Mod/JitRebalancer.cpp: Implement JIT rebalancing. 2020-10-25 10:17:48 +08:00