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

update go-multiaddr to v0.11.0 #2467

Merged
merged 1 commit into from
Aug 14, 2023
Merged

update go-multiaddr to v0.11.0 #2467

merged 1 commit into from
Aug 14, 2023

Conversation

marten-seemann
Copy link
Contributor

This is getting in two important changes in go-multiaddr that many users have been complaining about (see release notes).

Comment on lines -217 to +221
slices.SortFunc(s, func(first, second *observedAddr) bool {
if first.numInbound > second.numInbound {
return true
slices.SortFunc(s, func(first, second *observedAddr) int {
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) {
return -1
}
return len(first.seenBy) > len(second.seenBy)
return 1
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 check the logic carefully.

Copy link
Member

Choose a reason for hiding this comment

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

lgtm.

if first.numInbound > second.numInbound {
return true
slices.SortFunc(s, func(first, second *observedAddr) int {
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Old behavior is still here, and the new behavior seems reasonable. Should we update the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old behavior is still here, and the new behavior seems reasonable.

What do you mean? I didn't mean to change the behavior. Did I mess up the logic?

Copy link
Member

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

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

The new code is strictly equivalent.

Comment on lines -217 to +221
slices.SortFunc(s, func(first, second *observedAddr) bool {
if first.numInbound > second.numInbound {
return true
slices.SortFunc(s, func(first, second *observedAddr) int {
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) {
return -1
}
return len(first.seenBy) > len(second.seenBy)
return 1
Copy link
Member

Choose a reason for hiding this comment

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

lgtm.

@fasmat
Copy link
Contributor

fasmat commented Aug 17, 2023

Will this change be included in v0.29.3? At the moment github.com/multiformats/go-multiaddr v0.11.0 prevents us from updating to v0.29.2.

@marten-seemann
Copy link
Contributor Author

That’s not possible according to semver rules.

@fasmat
Copy link
Contributor

fasmat commented Aug 17, 2023

Then I'll guess we have to wait for v0.30.0 🙂

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