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

neutrino: Added ResetRanking method to PeerRanking. #288

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

Chinwendu20
Copy link
Contributor

@Chinwendu20 Chinwendu20 commented Sep 2, 2023

This PR addresses #280

Fixes #280

@Chinwendu20
Copy link
Contributor Author

@Crypt-iQ, this is the PR.

@Roasbeef Roasbeef requested a review from Crypt-iQ September 18, 2023 19:09
@@ -67,6 +67,8 @@ type PeerRanking interface {

// Order sorst the slice of peers according to their ranking.
Order(peers []string)

ResetRanking(peerAddr string)
Copy link
Member

Choose a reason for hiding this comment

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

Missing a godoc comment.

@@ -377,6 +379,11 @@ Loop:
result.job.timeout = newTimeout
}

// Refresh peer rank on disconnect.
if result.err == ErrPeerDisconnected {
w.cfg.Ranking.ResetRanking(result.peer.Addr())
Copy link
Member

Choose a reason for hiding this comment

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

Line should fold to 80 char columns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please I checked this in my IDE and it is less than 80 char column

Copy link
Member

Choose a reason for hiding this comment

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

@Chinwendu20 did you configure your IDE to use 8 spaces for a tab character? If not, this will probably pop up in future PRs as well (in lnd the line length is even enforced by a linter).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, this was one of my earlier PRs. I have now configured my IDE to this. Does it still appear as going beyond the limit?

Copy link
Member

Choose a reason for hiding this comment

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

This particular line as it was merged, yes. But no big deal, just wanted to let you know for future PRs.

query/peer_rank.go Show resolved Hide resolved
Copy link
Contributor

@Crypt-iQ Crypt-iQ left a comment

Choose a reason for hiding this comment

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

LGTM once @Roasbeef comments addressed 🎉

@Chinwendu20
Copy link
Contributor Author

Thank you guys but I am.not sure if this PR is still valid. Since there is no need to reset ranking?

@Roasbeef
Copy link
Member

Since there is no need to reset ranking?

What makes you think that? IIUC, the original intent was the a peer's ranking isn't necessarily the same between reconnects (changes in network, implementation, hardware, etc, etc). I'd consider the fact that they were never reset to be a bug.

@Chinwendu20
Copy link
Contributor Author

Since there is no need to reset ranking?

What makes you think that? IIUC, the original intent was the a peer's ranking isn't necessarily the same between reconnects (changes in network, implementation, hardware, etc, etc). I'd consider the fact that they were never reset to be a bug.

Oh okay, this comment: #280 (comment), I was just wondering since work would still be distributed, there would be no need for fetch from that from that particular peer which disconnected.

But I guess the current setup makes for a bug in itself, thanks for pointing it out.

@lightninglabs-deploy
Copy link

@Chinwendu20, remember to re-request review from reviewers when ready

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🍬

@Roasbeef Roasbeef merged commit f25dd27 into lightninglabs:master Jan 12, 2024
4 checks passed
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.

refresh peer's rank on reconnect
5 participants