Add probe path selection for background liquidity probing#4664
Add probe path selection for background liquidity probing#4664151henry151 wants to merge 1 commit into
Conversation
|
👋 Thanks for assigning @tnull as a reviewer! |
|
No new issues found in this re-review pass. The previously flagged issues have been addressed in the current commit. Review SummaryPreviously flagged issues — now resolved:
Still open (judgment calls, not re-posted):
I verified the refactored preflight loop and the shared |
|
Addressed the bot feedback in cbd9c04: corrected the Is the norm here is to squash this kind of follow-up into one commit or keep the two-commit history? |
|
Addressed all three comments in the latest commit (b17afa6). Moved probe score-param tuning to Squash commits, or keep history? |
|
🔔 1st Reminder Hey @wpaulino! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @wpaulino! This PR has been waiting for your review. |
b17afa6 to
914d5db
Compare
|
Squashed to one commit — review feedback folded in, instead of added as fix-ups on top. |
Add RouteParameters::from_probe_target, ProbabilisticScoringFeeParameters::for_probing, and ScoreLookUp::params_for_probe so background probes route through find_route with diversity scoring. Add ChannelManager::send_probe_to_node and probing integration tests. Fixes lightningdevkit#2720
914d5db to
7d1af6f
Compare
|
Latest squash sets max_path_count = 1 in from_probe_target per bot feedback. |
|
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
tnull
left a comment
There was a problem hiding this comment.
Hmm, we discussed before where background probing related logic should live and decided against expanding the logic in rust-lightning. Rather, background probing capabilities are now being added in lightningdevkit/ldk-node#815, so I'm not sure if we should go down the road of additional background-probing specific API changes in LDK?
|
Ah, I hadn't seen that PR. Not sure what the right answer is regarding the right background probing API - my understanding previously was that we'd not want to add stuff in the However, lightningdevkit/ldk-node#815 is a lot more than that. Its also adding new logic for how to build paths for probes beyond our existing logic. If it were as trivial as "pick a random node and send a random amount" I'd think it probably isn't worth upstreaming but its more than that - its both some code to select nodes based on various heuristics as well as a whole new router that does a random walk rather than selecting a path based on our existing scoring heuristics. If we want to go that direction and have a lot of additional logic that we think is important for doing good probing, IMO that should go in That said, I'm not really sure that we want that much additional logic? Do we really think LDK Node users are going to be configuring their probing heuristics with a custom pathfinder? Or even tuning much beyond selecting which nodes to probe based on their historical payment targets? |
PR description updated (2026-06-08) to match review feedback in
b17afa6b4.Issue #2720 originally suggested a wrapper
ScoreLookUparoundProbabilisticScorer. #3422 already addedprobing_diversity_penalty_msatfor the same purpose; this PR wires that field into background probe path selection without a redundant wrapper or separate router API.Background prober loops (random target/amount on a timer) remain userland / separate-crate per maintainer consensus.
This adds
RouteParameters::from_probe_target(uncapped routing fees and a runtime-onlybackground_probeflag),ProbabilisticScoringFeeParameters::for_probing(amount_msat)(sets a diversity penalty when none is configured), andScoreLookUp::params_for_probe(ProbabilisticScorercallsfor_probing;DefaultRouter::find_routecalls it automatically whenbackground_probeis set). Background probes route through the existingfind_routepath — there is no separatefind_probe_routeonRouter.ChannelManager::send_probe_to_nodeis the simple find-and-send entry point. Manual callers using the freefind_routeshould callscorer.params_for_probe(...)themselves. Preflight probe sending shares an internaltrim_unannounced_probe_last_hopshelper; behavior is unchanged. Router and functional tests verify probe path diversity across repeated probes and end-to-end probe sending.For ongoing probing, use
send_probe_to_nodewith aDefaultRouter— diversity scoring is applied per call viaparams_for_probe. Alternatively, setprobing_diversity_penalty_msaton the router at construction for fixed probe amounts. This is intentionally different fromsend_spontaneous_preflight_probes, which probes all MPP paths with payment fee caps and tries to avoid saturating liquidity immediately before the payment is sent.Fixes #2720
Tested with:
cargo +1.75.0 test -p lightning --lib probing— passedcargo +1.75.0 test -p lightning --lib find_probe_route— passedcargo +1.75.0 test -p lightning --lib for_probing— passedcargo +1.75.0 test -p lightning --lib preflight_probe— passedcargo +1.75.0 test -p lightning --lib router::tests— passedcargo +1.75.0 doc -p lightning --no-deps— passedRUSTFLAGS="--cfg=c_bindings" cargo +1.75.0 check -p lightning— passedcargo +1.75.0 fmt --all— passed