Skip to content

Channel fee penalty (WIP) #635

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

Conversation

sourabhmarathe
Copy link
Contributor

Idea is to have an interface between NetworkGraph and the user's personal channel metadata. The user needs to implement a way of converting their metadata into a fee penalty so that NetworkGraph's route-finding algorithm remains tractable.

@codecov
Copy link

codecov bot commented May 31, 2020

Codecov Report

Merging #635 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #635   +/-   ##
=======================================
  Coverage   91.26%   91.26%           
=======================================
  Files          35       35           
  Lines       20929    20929           
=======================================
  Hits        19101    19101           
  Misses       1828     1828           
Impacted Files Coverage Δ
lightning/src/routing/network_graph.rs 91.61% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2087032...72f9cf2. Read the comment docs.

@sourabhmarathe
Copy link
Contributor Author

@TheBlueMatt @ariard Can you take a look?

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

Looking more on the high-level interface, we may want to have a wrapper one like ChannelScorer to interact with both NetGraphMsgHandler and get_route. So Metadata approach and calculate_minimum_fee_penalty makes sense.

What we may want to do is the default implementation of our ChannelScorer composing score from a list of sub-components like iterating over Vec<ScorerProducer> and payment_success/failure is one of such implementation of trait ScoreProducer. A client must implement the data feeding part from PaymentSuccess/PaymentFailure reception.

That way a client can benefits from our default ScoreProducer impls and add custom ones easily (ChannelScorer::add_scorer_producer)

@@ -488,6 +503,13 @@ impl std::fmt::Display for NetworkGraph {
}
}

/// By default, just do nothing when scoring channels. A user is free to extend these
/// definitions to meet their needs.
Copy link

Choose a reason for hiding this comment

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

It would be great to have example in documentation, like a type Metadata being a struct BasicReliability { uptime: u32, flapiness: u32 }. Just a doc example not a default implementation.

@TheBlueMatt
Copy link
Collaborator

I think the biggest goal of a default channel scorer would be to ensure we don't return a just-failed route - currently if we happily return the same (lowest-fee) route over and over again and there isn't an easy way to say "I literally just tried that route and it failed". Doing more fancy stuff is cool, but just starting with a nice trait and something simple to address this failure mode would be a massive win.

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.

4 participants