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

Use block download when ranking peers #3500

Merged
merged 1 commit into from
Nov 23, 2021
Merged

Use block download when ranking peers #3500

merged 1 commit into from
Nov 23, 2021

Conversation

karknu
Copy link
Contributor

@karknu karknu commented Nov 22, 2021

Use both who ever gave us a header first, and who ever provided us with
the block first when ranking peers in deadline mode. For larger blocks
forged far away it is likely that we learned of the header
from a node on another continent, but the node from which we first
downloaded the block is much closer. This change gives both nodes
credit.

@karknu karknu force-pushed the karknu/boup branch 3 times, most recently from ce103fa to 604104f Compare November 22, 2021 10:33
@karknu karknu marked this pull request as ready for review November 22, 2021 12:38
@karknu karknu requested a review from coot as a code owner November 22, 2021 12:38
Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor comment about better names.

@@ -163,5 +163,24 @@ fetchyness = Pq.fold' count Map.empty
fn Nothing = Just $ fromIntegral bytes
fn (Just oldBytes) = Just $! oldBytes + fromIntegral bytes

-- Returns a Map which counts the number of times a given peer
-- was the first we downloaded a block from.
fetchyness'
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rename fetchyness' maybe as fetchynessBlockCount and also rename fetchyness as fetchynessBytes. Or something like that.

Use both who ever gave us a header first, and who ever provided us with
the block first when ranking peers in deadline mode. For larger blocks
forged far away it is likely that we learned of the header
from a node on another continent, but the node from which we first
downloaded the block is much closer. This change gives both nodes
credit.
@karknu
Copy link
Contributor Author

karknu commented Nov 23, 2021

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 23, 2021

@iohk-bors iohk-bors bot merged commit 273f006 into master Nov 23, 2021
@iohk-bors iohk-bors bot deleted the karknu/boup branch November 23, 2021 11:28
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.

2 participants