Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodical external pathfinding scores merge #449

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Jan 29, 2025

Fixes #313

Depends on lightningdevkit/rust-lightning#3562

Export functionality in #458

@joostjager joostjager changed the title Import scores Periodical external score merge Jan 30, 2025
@joostjager joostjager force-pushed the import-scores branch 2 times, most recently from e0b7070 to 58acc12 Compare January 30, 2025 13:31
@joostjager joostjager force-pushed the import-scores branch 3 times, most recently from 5858404 to fdf2b5d Compare January 30, 2025 14:04
@joostjager joostjager marked this pull request as ready for review January 31, 2025 08:53
@tnull tnull added this to the 0.6 milestone Jan 31, 2025
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Did a first pass, already looks pretty good!

@joostjager joostjager force-pushed the import-scores branch 2 times, most recently from 5a42ff9 to 0cf5774 Compare February 1, 2025 17:04
@joostjager joostjager force-pushed the import-scores branch 3 times, most recently from 619c9c9 to 6ded8af Compare February 3, 2025 10:01
@joostjager joostjager force-pushed the import-scores branch 5 times, most recently from 7bf68af to 14167eb Compare February 4, 2025 12:33
@joostjager joostjager requested a review from tnull February 4, 2025 14:43
@joostjager joostjager changed the title Periodical external score merge Periodical external pathfinding scores merge Feb 5, 2025
async fn sync_external_scores(
logger: &Logger, scorer: &Mutex<CombinedScorer<Arc<Graph>, Arc<Logger>>>,
node_metrics: &RwLock<NodeMetrics>, kv_store: Arc<DynStore>, url: &String,
) -> () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return a Result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so - this function cannot fail?

src/scoring.rs Outdated
match body {
Err(e) => {
log_error!(logger, "Failed to read external scores update: {}", e);
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid these explicit returns if possible.

Copy link
Contributor Author

@joostjager joostjager Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, not necessary. I wanted to exit the parent function with these returns, but just letting it run would have the same result.

In this current revision I now have a few real ones, after unwrapping the matches a bit.

@joostjager
Copy link
Contributor Author

Comments addressed. Now need to decide in lightningdevkit/rust-lightning#3562 how to read the combined scorer from disk (with local and merged data), and apply that in this PR.

Save external pathfinding scores in a cache so that they will be
available immediately after a node restart. Otherwise there might be a
time window where new scores need to be downloaded still and the node
operates on local data only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to download and import a scorer from a binary file
2 participants