Skip to content

Conversation

@amitiuttarwar
Copy link
Contributor

This PR removes support for 3 fields on the getpeerinfo RPC that were deprecated in v0.21- addnode, banscore & whitelisted.

@amitiuttarwar
Copy link
Contributor Author

These fields were deprecated in #19469, #19770, #19725. @jonatack & @luke-jr, if you get the chance, would appreciate your review :)

@amitiuttarwar amitiuttarwar force-pushed the 2020-12-getpeerinfo-deprecate branch from 9b76a46 to 3653ac5 Compare December 23, 2020 18:40
@amitiuttarwar
Copy link
Contributor Author

Updated to include PR # in release notes

@amitiuttarwar
Copy link
Contributor Author

amitiuttarwar commented Dec 23, 2020

I believe we can get rid of the m_legacyWhitelisted field on CNode, but am still trying to build confidence.

There is a code comment: //If this flag is present, the user probably expect that RPC and QT report it as whitelisted (backward compatibility). In this PR I'm removing the RPC endpoint, but I'm unable to find anywhere in QT that reveals this field. I'm unfamiliar with QT, maybe it was already removed, or maybe I'm missing it.

@NicolasDorier - since you introduced this, wondering if you have any thoughts?

update: realized QT usage was removed in 784ef8b in bitcoin-core/gui#34. I have since updated this branch to remove m_legacyWhitelisted

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 23, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Approach ACK

@amitiuttarwar
Copy link
Contributor Author

I realized this removes the last use of m_legacyWhitelisted, so I deleted the field.

@maflcko
Copy link
Member

maflcko commented Dec 24, 2020

Nice cleanup. Concept ACK

@amitiuttarwar amitiuttarwar force-pushed the 2020-12-getpeerinfo-deprecate branch from 96ce5dc to 454a408 Compare December 26, 2020 21:32
@amitiuttarwar
Copy link
Contributor Author

rebased

@sipa
Copy link
Member

sipa commented Dec 27, 2020

utACK 454a408

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

ACK 454a408.

You can remove a no-longer-needed local variable if you touch this again.

pnode->AddRef();
pnode->m_permissionFlags = permissionFlags;
// If this flag is present, the user probably expect that RPC and QT report it as whitelisted (backward compatibility)
pnode->m_legacyWhitelisted = legacyWhitelisted;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can get rid of the local variable legacyWhitelisted entirely.

@maflcko maflcko merged commit e3dd0a5 into bitcoin:master Dec 28, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 28, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 28, 2020
@michaelfolkson
Copy link

Looks like no one tested this before merging. Fixed in #20791 but as a post mortem should have been tested prior to merging.

@maflcko
Copy link
Member

maflcko commented Dec 29, 2020

Looks like no one tested this before merging. Fixed in #20791 but as a post mortem should have been tested prior to merging.

I am not sure what you mean. clang doesn't emit this warning, as explained in #20791 (comment). Merging any pull will be impossible if maintainers are required to build with all supported compiler versions on all supported platforms.

Regardless, this has long been pointed out during review: #20755 (review) with the comment: "You can remove a no-longer-needed local variable if you touch this again."

Moreover, -Wunused (and other warnings) are known to be broken for more than 13 years (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89180) in gcc. Rushing to "fix" (silence) them with patches that will break code (#20797 (comment)) is not the way to go. Personally, I prefer correct code over code that is incorrect, but doesn't emit any warnings.

@michaelfolkson
Copy link

This could have been easily caught with a simple manual grep right? For something basic like this someone should do that grep before it is merged? Or am I missing something?

The above is interesting context though, thanks.

@jonatack
Copy link
Member

Rushing to "fix" (silence) them with patches that will break code (#20797 (comment)) is not the way to go. Personally, I prefer correct code over code that is incorrect, but doesn't emit any warnings.

Diligence and vigilance does not mean I am suggesting we rush to break the code to silence the compiler. I'm not interested in blame games, only making bitcoin more robust.

@maflcko
Copy link
Member

maflcko commented Dec 29, 2020

This could have been easily caught with a simple manual grep right?

Yes, and I assume that either grep or --function-context was used to find it in #20755 (review).

@jonatack Sorry, didn't want to blame you. It was the most recent example that came to mind. There are many more examples, including many by me. I should have used one of myself.

@jonatack
Copy link
Member

Thanks. I think given enough time it happens to everyone anyway. Teamwork makes the dream work.

@jnewbery
Copy link
Contributor

Looks like no one tested this before merging. Fixed in #20791 but as a post mortem should have been tested prior to merging.

This is an entirely unhelpful comment. The 'problem' here is that a variable is now unused and certain compilers warn about it. Unused variables are exactly that - unused - and so have no impact on the logic of the program. In fact, compilers will optimize them out, so I expect the produced object is exactly the same before and after #20791.

This was spotted in review, found to not be an issue, and would have been fixed if the branch was retouched. Instead it was fixed in a follow-up PR. There's absolutely no problem here.

I assume that either grep or --function-context was used to find it in #20755 (review).

Just careful review. If a change means that a variable is no longer used in one place, it's good practice to see where else that variable is used.

@michaelfolkson
Copy link

It seems sloppy to me. Either remove it in the PR or merge it with an instruction that someone should open a new PR to remove it. I don't think it is great hygiene to just leave it hanging in a past comment (but maybe that is just me)

Don't want to belabor the point though (especially when being told it is "entirely unhelpful")

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants