clboss/Boss/Msg
Ken Sedgwick fa69423d61
EarningsTracker: attribute clboss-xrebalance per-part fees + amounts
XMoveFunds successful rebalances were moving real sats but
reporting nothing to clboss's earnings stats -- they did not show
up in clboss-status, in the fee model, or anywhere else operators
could see them.  This wires per-part attribution end-to-end via a
new bus message.

New message:

  Boss::Msg::XRebalanceAttribution { source, destination,
                                     amount_moved, fee_spent }

Emission (XMoveFunds):

  Inside the existing waitsendpay-success branch, after pushing
  the result and accumulating positive-reinforcement feedback for
  the middle hops, parse the askrene path for this part:

    - source peer = path[0]["node_id_out"] -- the peer we
      forwarded to on the first hop, i.e. the far end of the
      source channel for this part.
    - dest peer   = path[last]["node_id_in"] -- the peer that
      forwarded back to us on the closing hop (a.k.a. fill_peer).
    - amount_moved = waitsendpay.amount_msat (delivered to us).
    - fee_spent    = amount_sent_msat - amount_msat.

  Defensive on malformed JSON: missing fields, non-array path,
  or amount_sent < amount_moved all skip the raise rather than
  crash the success handler.

  An MPP-split clboss-xmovefunds invocation that lands different
  parts on different (source, dest) pairs (the common case once
  source_scid / dest_scid are sets) gets one attribution per part,
  with the actual pair each part used -- finer-grained than
  FundsMover's per-Runner attribution.

Subscription (EarningsTracker):

  Subscribe alongside the existing Msg::ResponseMoveFunds handler
  and run the same symmetric DB update -- source peer gets
  in_expenditures += fee and in_rebalanced += amount, destination
  peer gets out_expenditures += fee and out_rebalanced += amount.
  No pendings lookup: XMoveFunds already identified both peers
  before raising, so the new path skips the requester -> Pending
  map entirely.

Symmetry sanity check while wiring:

  The DEVSTATE/REBALANCER-REDESIGN-2026-05-28.org "Earnings
  attribution symmetry" note flagged that the FundsMover path
  might debit only one side.  Verified against the current code:
  response_move_funds already updates both source's in_* and
  destination's out_* (EarningsTracker.cpp around lines 430 and
  447) -- no fix needed there.  The doc concern was correct at
  the time but has been resolved since.
2026-06-01 10:50:34 -07:00
..
AcceptSwapQuotation.hpp Boss/Mod/BoltzSwapper/ServiceModule.cpp: Thin wrapper around Boltz::Service. 2020-09-27 00:25:12 +08:00
AmountSettings.hpp Boss/Mod/AmountSettingsHandler.cpp: New module to centralize some size settings. 2022-04-21 12:40:02 +08:00
AvailableRpcCommands.hpp Boss/Mod/AvailableRpcCommandsAnnouncer.cpp: New module to announce the commands found on this node. 2022-05-04 00:34:22 +00:00
Begin.hpp Boss/Msg/Begin.hpp: Message sent at beginning of boss. 2020-09-07 10:55:40 +08:00
Block.hpp Boss/Mod/BlockTracker.cpp: Track blocks. 2020-09-08 17:03:48 +08:00
ChannelCreateResult.hpp Boss/Mod/ChannelCreator/Carpenter.cpp: Implement actual channel creation. 2020-09-17 14:02:24 +08:00
ChannelCreation.hpp Boss/Mod/ChannelCreateDestroyMonitor.cpp: Module to monitor channel creation and destruction events. 2020-10-13 15:53:44 +08:00
ChannelDestruction.hpp Boss/Mod/ChannelCreateDestroyMonitor.cpp: Module to monitor channel creation and destruction events. 2020-10-13 15:53:44 +08:00
ChannelFunds.hpp Boss/Mod/ChannelFundsComputer.cpp: Module to compute channel funds. 2020-09-15 12:11:08 +08:00
CommandFail.hpp *: Use Ln::CommandId for command IDs for received commands and hook events. 2022-11-23 00:36:43 +08:00
CommandRequest.hpp *: Use Ln::CommandId for command IDs for received commands and hook events. 2022-11-23 00:36:43 +08:00
CommandResponse.hpp *: Use Ln::CommandId for command IDs for received commands and hook events. 2022-11-23 00:36:43 +08:00
DbResource.hpp Boss/Msg/DbResource.hpp: New message specifically for DB only. 2020-09-28 12:46:57 +08:00
EndOfOptions.hpp Boss/Msg/EndOfOptions.hpp: New message sent when options from init have been processed. 2022-04-21 12:40:02 +08:00
ForwardFee.hpp Add associated primary volume (forwarded and rebalanced) to EarningsTracker 2024-09-25 13:23:04 -05:00
Init.hpp Boss/Msg/Init.hpp: Add always_use_proxy flag. 2020-10-20 19:32:48 +08:00
InternetOnline.hpp Boss/Mod/InternetConnectionMonitor.cpp: broadcast InternetOnline message on changes in connection. 2020-10-05 14:50:11 +08:00
JsonCin.hpp Boss/JsonInput.cpp: Implement input loop. 2020-09-07 11:51:30 +08:00
JsonCout.hpp Boss/Mod/JsonOutputter.cpp: Module to output JSON to the COUT. 2020-09-07 16:43:19 +08:00
ListfundsAnalyzedResult.hpp Boss/Mod/ListfundsAnalyzer.cpp: Module to analyze result of listfunds command. 2022-04-21 12:30:29 +08:00
ListfundsResult.hpp Boss/Mod/ListfundsAnnouncer.cpp: Module to announce funds. 2020-09-15 11:29:39 +08:00
ListpeersAnalyzedResult.hpp Boss/Msg/ListpeersAnalyzedResult.hpp: New message containing binned listpeers. 2020-09-13 18:05:29 +08:00
ListpeersResult.hpp Convert ListpeerResult to use ConstructedListpeers 2024-06-02 16:19:56 -07:00
Manifestation.hpp Boss/Mod/Manifester.cpp: Module to handle getmanifest. 2020-09-07 19:05:56 +08:00
ManifestCommand.hpp Boss/Mod/Manifester.cpp: Module to handle getmanifest. 2020-09-07 19:05:56 +08:00
ManifestHook.hpp Boss/Mod/Manifester.cpp: Module to handle getmanifest. 2020-09-07 19:05:56 +08:00
ManifestNotification.hpp Boss/Mod/Manifester.cpp: Module to handle getmanifest. 2020-09-07 19:05:56 +08:00
ManifestOption.hpp XMoveFunds: age the clboss-xrebalance layer, runtime-tunable via setconfig 2026-06-01 09:50:46 -07:00
MonitorFeeByBalance.hpp feemon: add fee monitor to save per-channel stats 2026-02-27 14:28:53 -08:00
MonitorFeeBySize.hpp feemon: add fee monitor to save per-channel stats 2026-02-27 14:28:53 -08:00
MonitorFeeByTheory.hpp feemon: add price theory center price 2026-02-27 14:28:55 -08:00
MonitorFeeSetChannel.hpp feemon: add fee monitor to save per-channel stats 2026-02-27 14:28:53 -08:00
NeedsConnect.hpp Boss/Mod/InitialConnect.cpp: Check for initial connection. 2020-09-08 19:47:33 +08:00
NeedsOnchainFunds.hpp Boss/Msg/NeedsOnchainFunds.hpp: Message broadcast when we need onchain funds. 2020-09-29 13:20:43 +08:00
Network.hpp Update Network.hpp 2024-05-23 21:59:37 -07:00
Notification.hpp Boss/Mod/CommandReceiver.cpp: Parser of commands. 2020-09-07 17:51:36 +08:00
OnchainFee.hpp Boss/Msg/OnchainFee.hpp: Include feerate in message. 2021-08-11 18:18:05 +08:00
OnchainFunds.hpp Boss/Mod/OnchainFundsAnnouncer.cpp: Module to check for funds. 2020-09-15 09:11:12 +08:00
Option.hpp XMoveFunds: age the clboss-xrebalance layer, runtime-tunable via setconfig 2026-06-01 09:50:46 -07:00
OptionType.hpp Boss/Mod/Manifester.cpp: Add support for options. 2020-11-22 12:30:23 +00:00
PatronizeChannelCandidate.hpp Boss/Mod/ChannelCandidateInvestigator/: Begin coding to support patronless channel candidates. 2020-10-01 11:26:25 +08:00
PayInvoice.hpp Boss/Mod/InvoicePayer.cpp: Module to pay invoices. 2020-09-28 11:28:07 +08:00
PeerMedianChannelFee.hpp Boss/Mod/PeerCompetitorFeeMonitor/: Module to determine channel fees going into our peers. 2020-09-30 13:30:58 +08:00
PeerMetrics.hpp Boss/Msg/PeerMetrics.hpp: Make copyable. 2020-11-05 14:48:38 +08:00
PeerStatistics.hpp Boss/Mod/PeerStatistician.cpp: Stores statistics. 2020-10-06 13:26:09 +08:00
PreinvestigateChannelCandidates.hpp Boss/Msg/PreinvestigateChannelCandidates.hpp: New message for preinvestigating. 2020-09-14 04:17:57 +08:00
ProbeActively.hpp Boss/Mod/ActiveProber.cpp: active probing module. 2020-10-07 15:06:38 +08:00
ProposeChannelCandidates.hpp Boss/Msg/PreinvestigateChannelCandidates.hpp: New message for preinvestigating. 2020-09-14 04:17:57 +08:00
ProposeConnectCandidates.hpp Boss/Mod/NeedsConnectSolicitor.cpp: Module to solicit nodes to connect to. 2020-09-09 15:18:25 +08:00
ProposePatronlessChannelCandidate.hpp Boss/Mod/ChannelCandidateInvestigator/: Begin coding to support patronless channel candidates. 2020-10-01 11:26:25 +08:00
ProvideChannelFeeModifier.hpp feat: add clang C++20 build job to CI 2026-03-04 11:24:31 -08:00
ProvideDeletablePaymentLabelFilter.hpp Boss/Mod/PaymentDeleter.cpp: Generalized deleter of probe and funds-movement payments. 2021-04-28 19:02:31 +08:00
ProvideHtlcAcceptedDeferrer.hpp *: Silence clang warnings. 2020-11-02 19:02:35 +08:00
ProvideStatus.hpp Boss/Mod/StatusCommand.cpp: Add facility to get status. 2020-09-18 06:23:49 +08:00
ProvideSwapQuotation.hpp Boss/Msg/ProvideSwapQuotation.hpp: Add string name of swap service. 2021-11-27 12:53:05 +00:00
ProvideUnmanagement.hpp Boss/Mod/UnmanagedManager.cpp: Module to suppress automatic management. 2021-03-01 17:17:12 +08:00
RaisePeerComplaint.hpp Boss/Mod/PeerComplaintsDesk/Recorder.cpp: Sub-module to record complaints in our database. 2021-04-08 18:08:45 +08:00
ReleaseHtlcAccepted.hpp Boss/Mod/HtlcAcceptor.cpp: Module to handle and dispatch HTLC acceptance. 2020-10-03 18:49:27 +08:00
ReqRespTraits.hpp Boss/Msg/ReqRespTraits.hpp: Use a traits class for requests and response. 2023-07-11 20:57:51 +08:00
RequestChannelCreation.hpp Boss/Mod/ChannelCreationDecider.cpp: Module to decide on whether to create channels. 2020-09-15 14:49:51 +08:00
RequestConnect.hpp Boss/Mod/Connector.cpp: Module to connect to other nodes. 2020-09-09 09:52:08 +08:00
RequestDowser.hpp Boss/Msg/RequestDowser.hpp: Make explicit that dowsing has a direction. 2020-11-17 11:57:00 +08:00
RequestEarningsInfo.hpp Boss/Mod/EarningsTracker.cpp: Module to keep track of fee earnings, for use with rebalancing decisions. 2020-10-23 23:48:07 +08:00
RequestGetOnchainIgnoreFlag.hpp Boss/Mod/OnchainFundsIgnorer.cpp: Module to provide a flag for ignoring or noticing onchain funds. 2020-11-20 00:11:38 +08:00
RequestListpays.hpp Boss/Mod/ListpaysHandler.cpp: Module to perform listpays. 2020-09-28 14:48:19 +08:00
RequestMoveFunds.hpp Boss/Mod/FundsMover/: Start implementing funds mover module. 2020-10-20 09:06:58 +08:00
RequestNewaddr.hpp Boss/Mod/NewaddrHandler.cpp: Module to perform newaddr commands. 2020-09-28 16:17:47 +08:00
RequestPeerFromScid.hpp Boss/Mod/PeerFromScidMapper.cpp: Module to centralize getting peer node IDs from SCIDs. 2023-07-11 20:57:51 +08:00
RequestPeerMetrics.hpp Boss/Mod/PeerMetrician.cpp: Add metrics generator. 2020-10-06 15:38:13 +08:00
RequestPeerStatistics.hpp Boss/Mod/PeerStatistician.cpp: Stores statistics. 2020-10-06 13:26:09 +08:00
RequestRebalanceUnmanaged.hpp 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
RequestRpcCommand.hpp 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
RequestSelfUptime.hpp Boss/Mod/SelfUptimeMonitor.cpp: Module to track our own uptime. 2021-02-09 15:51:36 +08:00
ResponseConnect.hpp Boss/Mod/Connector.cpp: Module to connect to other nodes. 2020-09-09 09:52:08 +08:00
ResponseDowser.hpp Boss/Mod/Dowser.cpp: Move dowser to its own separate module. 2020-10-12 15:19:31 +08:00
ResponseEarningsInfo.hpp Add associated primary volume (forwarded and rebalanced) to EarningsTracker 2024-09-25 13:23:04 -05:00
ResponseGetOnchainIgnoreFlag.hpp Boss/Mod/OnchainFundsIgnorer.cpp: Module to provide a flag for ignoring or noticing onchain funds. 2020-11-20 00:11:38 +08:00
ResponseListpays.hpp Boss/Mod/ListpaysHandler.cpp: Module to perform listpays. 2020-09-28 14:48:19 +08:00
ResponseMoveFunds.hpp Boss/Mod/FundsMover/: Start implementing funds mover module. 2020-10-20 09:06:58 +08:00
ResponseNewaddr.hpp Boss/Mod/NewaddrHandler.cpp: Module to perform newaddr commands. 2020-09-28 16:17:47 +08:00
ResponsePeerFromScid.hpp Boss/Mod/PeerFromScidMapper.cpp: Module to centralize getting peer node IDs from SCIDs. 2023-07-11 20:57:51 +08:00
ResponsePeerMetrics.hpp Boss/Mod/PeerMetrician.cpp: Add metrics generator. 2020-10-06 15:38:13 +08:00
ResponsePeerStatistics.hpp Boss/Mod/PeerStatistician.cpp: Stores statistics. 2020-10-06 13:26:09 +08:00
ResponseRebalanceUnmanaged.hpp 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
ResponseRpcCommand.hpp 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
ResponseSelfUptime.hpp Boss/Mod/SelfUptimeMonitor.cpp: Module to track our own uptime. 2021-02-09 15:51:36 +08:00
RpcCommandHook.hpp Boss/Mod/CommandReceiver.cpp: Handle rpc_command at this level, to increase our responsiveness. 2020-11-10 10:19:53 +08:00
SendpayResult.hpp feat: add clang C++20 build job to CI 2026-03-04 11:24:31 -08:00
SetChannelFee.hpp Boss/Mod/ChannelFeeSetter.cpp: Module to change channel fees. 2020-09-30 15:26:28 +08:00
SolicitChannelCandidates.hpp Boss/Mod/ChannelFinderByPopularity.cpp: Proposes nodes to channel with via popularity. 2020-09-10 22:09:37 +08:00
SolicitChannelFeeModifier.hpp Boss/Mod/ChannelFeeManager.cpp: Module to consider other modules for modifying the channel fee settings. 2020-09-30 15:49:45 +08:00
SolicitConnectCandidates.hpp Boss/Mod/NeedsConnectSolicitor.cpp: Module to solicit nodes to connect to. 2020-09-09 15:18:25 +08:00
SolicitDeletablePaymentLabelFilter.hpp Boss/Mod/PaymentDeleter.cpp: Generalized deleter of probe and funds-movement payments. 2021-04-28 19:02:31 +08:00
SolicitHtlcAcceptedDeferrer.hpp Boss/Mod/HtlcAcceptor.cpp: Module to handle and dispatch HTLC acceptance. 2020-10-03 18:49:27 +08:00
SolicitPeerComplaints.hpp Boss/Mod/PeerComplaintsDesk/Main.cpp: Fill in operational code. 2021-04-08 18:08:45 +08:00
SolicitStatus.hpp Boss/Mod/StatusCommand.cpp: Add facility to get status. 2020-09-18 06:23:49 +08:00
SolicitSwapQuotation.hpp Boss/Mod/BoltzSwapper/ServiceModule.cpp: Thin wrapper around Boltz::Service. 2020-09-27 00:25:12 +08:00
SolicitUnmanagement.hpp Boss/Mod/UnmanagedManager.cpp: Module to suppress automatic management. 2021-03-01 17:17:12 +08:00
StatusListpays.hpp Boss/Mod/ListpaysHandler.cpp: Module to perform listpays. 2020-09-28 14:48:19 +08:00
SwapCompleted.hpp Boss/Mod/SwapManager.cpp: Broadcast information on how much we sent and received for a swap. 2021-11-27 12:53:05 +00:00
SwapCreation.hpp Boss/Msg/SwapCreation.hpp: Also include hash of the swap. 2020-09-28 11:40:34 +08:00
SwapRequest.hpp Boss/Mod/SwapManager.cpp: Offchain-to-onchain swap manager. 2020-09-29 08:17:33 +08:00
SwapResponse.hpp Boss/Mod/SwapManager.cpp: Offchain-to-onchain swap manager. 2020-09-29 08:17:33 +08:00
TaskCompletion.hpp Boss/Mod/NeedsConnectSolicitor.cpp: Module to solicit nodes to connect to. 2020-09-09 15:18:25 +08:00
Timer10Minutes.hpp Boss/Mod/Timers.cpp: Module to emit regular timing messages. 2020-09-08 18:40:19 +08:00
TimerRandomDaily.hpp Boss/Mod/Timers.cpp: Module to emit regular timing messages. 2020-09-08 18:40:19 +08:00
TimerRandomHourly.hpp Boss/Mod/Timers.cpp: Module to emit regular timing messages. 2020-09-08 18:40:19 +08:00
TimerTwiceDaily.hpp Boss/Msg/TimerTwiceDaily.hpp: Emitted twice a day. 2021-01-25 10:54:39 +08:00
XRebalanceAttribution.hpp EarningsTracker: attribute clboss-xrebalance per-part fees + amounts 2026-06-01 10:50:34 -07:00