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

Fix computation of path weight #1794

Merged
merged 2 commits into from
May 12, 2021
Merged

Fix computation of path weight #1794

merged 2 commits into from
May 12, 2021

Conversation

thomash-acinq
Copy link
Member

There are two cases depending on whether you use weight ratios or not. They used to behave very differently.

  • Without weight ratios, the weight would be the total amount to send (base amount + fees)
  • With weight ratios, the ratios would apply to the total amount, not just the fees. The effect is that only the number of hops and then the weight factors matter as the fee itself is negligible compared to the total amount.

The code is now shared and the weight is now the sum of the fees (multiplied by a factor if using weight ratios).

@thomash-acinq thomash-acinq requested a review from t-bast May 11, 2021 14:26
@codecov-commenter
Copy link

Codecov Report

Merging #1794 (86cb2fe) into master (55b50ec) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1794   +/-   ##
=======================================
  Coverage   89.35%   89.36%           
=======================================
  Files         143      143           
  Lines       10933    10932    -1     
  Branches      476      481    +5     
=======================================
  Hits         9769     9769           
+ Misses       1164     1163    -1     
Impacted Files Coverage Δ
.../src/main/scala/fr/acinq/eclair/router/Graph.scala 98.14% <100.00%> (-0.02%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 86.39% <0.00%> (ø)
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 85.10% <0.00%> (+0.42%) ⬆️

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM, good catch!

@t-bast t-bast merged commit c641549 into master May 12, 2021
@thomash-acinq thomash-acinq deleted the best-fees branch May 12, 2021 13:00
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.

3 participants