Conversation
Create new background task for probing, add its initialization to the builder. Add new trait ProobingStrategy with two default implementations. Total amount of sats in current non-finished probes is tracked, it is changed on ProbeSucceded and ProbeFailed events.
There are 3 probing tests: - check that probing lock liquidity amount changes - test that new probes are not fired if the max locked liquidity is reached (for example if on of the nodes goes down) - probing perfomance test which sets up 4 probing nodes (random strategy, high-degree without penalty, high-degree with penalty, control node without probing). A network of several nodes is set up; these nodes make payments to one another and probing nodes observe their behaviour. Next the scorer estimates are printed out. Scorer channel estimates are exposed for the purposes of the test. Scoring parameters (probing penalty) is exposed to be set up during node builiding. Random probing strategy constructs the maximal possible route (up to the set limit) instead of failing when the next hop is not possible to construct.
Probing locked amount involves hops' fees, not only the last hop. Remove usage of cursor in favor of Atomicusize for pseudorandom pick of channels for random strategy. Add check that min_probe amount is indeed smaller than max_probe_amount. Add liquidity_limit_multiplier to probing config instead of hardocded None value.
Remove Prober::run method in favor of distinct function. Tidy probing tests.
|
👋 Thanks for assigning @tnull as a reviewer! |
|
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 3rd Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 4th Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 5th Reminder Hey @tnull! This PR has been waiting for your review. |
Added a probing service which is used to send probes to estimate channels' capacities.
Related issue: #765.
Probing is intended to be used in two ways:
For probing a new abstraction
Proberis defined and is (optionally) created during node building.Prober periodically sends probes to feed the data to the scorer.
Prober sends probes using a ProbingStrategy.
ProbingStrategy trait has only one method:
fn next_probe(&self) -> Option<Probe>; every tick it generates a probe, whereProberepresents how to send a probe.To accommodate two different ways the probing is used, we either construct a probing route manually (
Probe::PrebuiltRoute) or rely on the router/scorer (Probe::Destination).Prober tracks how much liquidity is locked in-flight in probes, prevents the new probes from firing if the cap is reached.
There are two probing strategies implemented:
Random probing strategy, it picks a random route from the current node, the route is probed via
send_probe, thus ignores scoring parameters (what hops to pick), it also ignoresliquidity_limit_multiplierwhich prohibits taking a hop if its capacity is too small. It is a true random route.High degree probing strategy, it examines the graph and finds the nodes with the biggest number of (public) channels and probes routes to them using
send_spontaneous_preflight_probeswhich uses the current router/scorer.The former is meant to be used on payment nodes, while the latter on probing nodes. For the HighDegreeStrategy to work it is recommended to set
probing_diversity_penalty_msatto some nonzero value to prevent routes reuse, however it may fail to find any available routes.There are three tests added:
Example output (runs for ~1 minute, needs
--nocaptureflag):For performance testing I had to expose the scoring data (
scorer_channel_liquidity).Also exposed
scoring_fee_params: ProbabilisticScoringFeeParameterstoConfig.TODOs: