clboss/Boss
Ken Sedgwick 0d128cc47d
JitRebalancer: skip rebalance if one is already in flight for the destination
The fee budget check reads out_expenditures, which is only
persisted once a rebalance completes (up to 120 s per run).  Each
incoming HTLC spawned an independent rebalance run with no guard,
so concurrent HTLCs to the same underfunded channel each passed
the check against the same stale value, multiplying the intended
25%-of-earnings aggregate cap by the number of concurrent triggers.

Skip HTLC-triggered rebalances for a node that already has one in
flight, mirroring the working guard in EarningsRebalancer.  Skipped
HTLCs are released immediately and proceed without JIT rebalancing;
a retry after the in-flight run completes sees both the refilled
channel and the updated budget.

Update the parallel-calls unit test to the new semantics: exactly
one of three concurrent calls is let in, only it requests a
rebalance, and the guard clears once the run completes.

Reported by an external security researcher via private disclosure.

Fixes #323
2026-08-12 15:03:22 -07:00
..
Mod JitRebalancer: skip rebalance if one is already in flight for the destination 2026-08-12 15:03:22 -07:00
ModG Boss/Msg/ReqRespTraits.hpp: Use a traits class for requests and response. 2023-07-11 20:57:51 +08:00
Msg feat: add clang C++20 build job to CI 2026-03-04 11:24:31 -08:00
concurrent.cpp Ev/Io.hpp: Avoid copying objects, just move things around. 2020-09-14 09:12:46 +08:00
concurrent.hpp Boss/concurrent.cpp: Wrapper for Ev::concurrent that ignores Boss::Shutdown exceptions. 2020-09-07 07:39:36 +08:00
JsonInput.cpp Boss/Mod/CommandReceiver.cpp: Handle rpc_command at this level, to increase our responsiveness. 2020-11-10 10:19:53 +08:00
JsonInput.hpp Boss/JsonInput.cpp: Implement input loop. 2020-09-07 11:51:30 +08:00
log.cpp Util/Str.cpp: Implement Util::Str::fmt. 2021-10-06 19:26:55 +08:00
log.hpp Boss/log.hpp: Have GCC do printf checks. 2020-11-24 18:58:39 +08:00
Main.cpp Avoid program_invocation_name which is available only on Linux 2024-10-28 12:12:15 -05:00
Main.hpp Boss/open_rpc_socket.cpp: Function to open the RPC socket. 2020-09-07 21:50:38 +08:00
open_rpc_socket.cpp Use BacktraceException for appropriate (most) exceptions 2024-08-19 15:04:30 -07:00
open_rpc_socket.hpp Boss/open_rpc_socket.cpp: Function to open the RPC socket. 2020-09-07 21:50:38 +08:00
random_engine.cpp Use BacktraceException for appropriate (most) exceptions 2024-08-19 15:04:30 -07:00
random_engine.hpp Boss/random_engine.cpp: Common random engine. 2020-09-10 00:13:02 +08:00
Shutdown.hpp Boss/Shutdown.hpp: Trivial struct for signalling shutdown. 2020-09-07 07:06:30 +08:00
Signer.cpp Use BacktraceException for appropriate (most) exceptions 2024-08-19 15:04:30 -07:00
Signer.hpp Boss/Signer.cpp: Signer for boltz-swapping transactions. 2020-09-23 12:45:50 +08:00