mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-20 13:28:15 +02:00
CLN v26.06 deprecates getroute in favor of askrene's getroutes. Replace the Dowser's getroute+listchannels loop (up to ~40 RPC round-trips) with a single getroutes call and let askrene's min-cost-flow solver enumerate multi-path capacity directly. Response parsing follows the getroutes schema; 205/206 (no route / too expensive) maps to zero capacity. Size the probe to the caller's threshold. The Dowser is a flow estimator: callers compare the dowsed flow against a channel size (the janitor and preinvestigator min-channel acceptance test, the channel creator's sizing). A fixed probe amount caps the estimate, so any threshold at or above that cap rejects every candidate regardless of real capacity. RequestDowser now carries a min_amount; callers that test against a channel size set it, and the probe runs at min_amount / reserve_factor so a full-flow result clears the threshold for any configured channel size. The channel creator dowses at max-channel so new channels size toward the operator ceiling instead of being pinned at the min-channel floor. The manual clboss-dowser command keeps the fixed default probe. Matchmaker, ActiveProber: migrate getroute -> getroutes for CLN v26.06 compat Continuation of the v26.06 migration started in the Dowser commit. Two more getroute call sites: ChannelCandidateMatchmaker.cpp and ActiveProber.cpp. Both use maxparts=1 since each wants a single route, not a flow estimate. ActiveProber probes the local node's own outbound liquidity, so it uses layers=["auto.localchans","auto.sourcefree"] per the standardized recipe. Matchmaker probes from a remote source (a candidate patron) to a remote target, so it passes an empty layers array -- auto.localchans would inject our private local channels into a foreign source, and auto.sourcefree would zero out the source's outgoing fees, either of which could make askrene pick a patron the proposal cannot actually reach via public topology. maxfee_msat is 1% of the probe amount in both cases. Matchmaker is a near-clean swap. The patron id (route[0].id in the old getroute shape) is read from routes[0].path[0] in the new getroutes shape; at the parse site we bridge the v26.06+ name (node_id_out) with its deprecated pre-v26.06 predecessor (next_node_id) via has()/ternary, so the code works on either CLN flavor. ActiveProber is more involved. The previous code stashed res["route"] as a Jsmn::Object and later appended hops from it directly into the sendpay route parameter, relying on the fact that the old getroute hop shape (id/channel/direction/ amount_msat/delay/style) was already sendpay-compatible. The new getroutes path[] shape is NOT directly sendpay-compatible (different field names, short_channel_id_dir encodes scid and direction together), so we now extract path[0] into typed values (id1, chan1, direction1, amount1, delay1) and rebuild the sendpay hop1 explicitly from those. The Jsmn::Object route member is dropped. The hop-field reads in ActiveProber bridge between v26.06+ (node_id_out / amount_out_msat / cltv_out) and the deprecated pre-v26.06 names (next_node_id / amount_msat / delay) via the same has()/ternary pattern. short_channel_id_dir splits on '/' with an explicit npos check; a missing slash throws Jsmn::TypeError so the surrounding parse- error log path catches it cleanly. Without the check, sdir.substr(0, npos) and sdir.substr(npos + 1) would feed malformed input into Ln::Scid (which throws std::invalid_argument, not caught by the Jsmn::TypeError handler) or into std::stoul (silently producing a wrong direction). ActiveProber also drops its vestigial exclude=[self_id] parameter: askrene's source/destination model naturally excludes self when source != self, which is always the case here (the probe always flows from peer outward, never back through us). Three of the four getroute call sites in CLBOSS are now on getroutes; the fourth (FundsMover/Attempter) is deferred to PR2 because its exclude-vector pattern encodes failure feedback from real payment attempts and warrants a redesign around askrene-inform-channel rather than a mechanical port.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#ifndef BOSS_MSG_REQUESTDOWSER_HPP
|
|
#define BOSS_MSG_REQUESTDOWSER_HPP
|
|
|
|
#include"Ln/Amount.hpp"
|
|
#include"Ln/NodeId.hpp"
|
|
|
|
namespace Boss { namespace Msg {
|
|
|
|
/** struct Boss::Msg::RequestDowser
|
|
*
|
|
* @brief Requests for a dowser estimation of the flow between
|
|
* two nodes.
|
|
*
|
|
* @desc The dowser just guesses how much capacity is available
|
|
* between the two specified nodes.
|
|
*/
|
|
struct RequestDowser {
|
|
void* requester;
|
|
Ln::NodeId fromid;
|
|
Ln::NodeId toid;
|
|
/* The flow level the caller wants the probe sized to. The dowser
|
|
* sizes its probe so that a full-flow result reaches this amount;
|
|
* the askrene dowser caps its result at the probe, so it can never
|
|
* report more than this. When zero (the default), the dowser uses
|
|
* its own fixed default probe amount.
|
|
*
|
|
* Threshold callers that only ask "is at least clboss-min-channel
|
|
* reachable?" set this to min-channel. Callers that SIZE something
|
|
* from the result -- the ChannelCreator opens up to the dowsed
|
|
* amount -- must set this to the largest amount they would use
|
|
* (clboss-max-channel); otherwise the result is pinned to the probe
|
|
* and the size collapses to it. */
|
|
Ln::Amount probe_target;
|
|
};
|
|
|
|
}}
|
|
|
|
#endif /* !defined(BOSS_MSG_REQUESTDOWSER_HPP) */
|