Commit graph

1 commit

Author SHA1 Message Date
Ken Sedgwick
bdd002d465
AskreneLayer: new shared module for clboss askrene-layer writes
Introduces Boss::Mod::AskreneLayer, a small shared module of free
functions that wrap the askrene layer-mutation RPCs against a named
layer.  This is the common infrastructure that the classic rebalancer
(FundsMover) and ActiveProber write their routing feedback into; both
producers land in following commits.

The layer name follows the xpay convention -- the persistent
shared-knowledge layer is named after the owning plugin.
clboss_layer_name = "clboss"; every CLBOSS writer targets this single
layer so downstream getroutes calls that include it in their layers
array benefit from the accumulated knowledge.

Functions:

  - inform_channel_constrained / inform_channel_unconstrained:
    askrene-inform-channel with inform=constrained / =unconstrained,
    recording a recent could-not-push upper bound on a directed
    channel, or clearing it.
  - disable_node: askrene-disable-node, steering routes away from a
    node.
  - is_node_disabled: reads askrene-listlayers to test whether a node
    is already disabled in the layer (lets writers dedup).
  - update_channel: askrene-update-channel, applying an xpay-style
    channel_update refresh.

All writers silently swallow RpcError: if the layer is unavailable
(e.g. CLN without askrene layers) the call degrades to a no-op rather
than crashing the caller -- degraded learning beats a crashed plugin.

A unit test (tests/boss/test_askrene_layer) covers each helper's method
and JSON shape plus the silent-RpcError-swallow contract, using the
socketpair MockRpcServer pattern.
2026-06-23 14:11:56 -07:00