8000 Use the stored CSubNet entry when unbanning by vasild · Pull Request #717 · bitcoin-core/gui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use the stored CSubNet entry when unbanning #717

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

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

vasild
Copy link
Contributor
@vasild vasild commented Mar 6, 2023

The previous code visualized the CSubNet object as string, then parsed that string back to CSubNet. This is sub-optimal given that the original CSubNet object can be used directly instead.

This avoids calling LookupSubNet() from the GUI.

@DrahtBot
Copy link
Contributor
DrahtBot commented Mar 6, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK furszy, mzumsande

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

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.

@vasild
Copy link
Contributor Author
vasild commented Mar 6, 2023

This would simplify bitcoin/bitcoin#27071.

Copy link
Member
@furszy furszy left a comment

Choose a reason for hiding this comment

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

Concept ACK

Would be better to not access the ban model internals from outside, it breaks encapsulation.
Could do furszy@81b667e

vasild and others added 2 commits March 6, 2023 16:06
The previous code visualized the `CSubNet` object as string, then
parsed that string back to `CSubNet`. This is sub-optimal given that
the original `CSubNet` object can be used directly instead.

This avoids calling `LookupSubNet()` from the GUI.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
@vasild
Copy link
Contributor Author
vasild commented Mar 6, 2023

@furszy, done, thanks!

Copy link
Member
@furszy furszy left a comment

Choose a reason for hiding this comment

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

utACK 4be57a5

Copy link
Contributor
@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

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

Tested ACK 4be57a5

I tested that banning and unbanning still works, the code changes look good to me (although I don't know the GUI very well).

@@ -37,7 +37,7 @@ class BannedNodeLessThan
};

/**
Qt model providing information about connected peers, similar to the
Qt model providing information about banned peers, similar to the
"getpeerinfo" RPC call. Used by the rpc console UI.
Copy link
Contributor

Choose a reason for hiding this comment

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

If this comment is fixed anyway (it was copied from peertablemodel.h), could also replace "getpeerinfo" with "listbanned".

}
BanTableModel* ban_table_model{clientModel->getBanTableModel()};
bool unbanned{false};
for (const auto& node_index : nodes) {
Copy link
Contributor
@mzumsande mzumsande Mar 8, 2023

Choose a reason for hiding this comment

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

Not a major issue, but this looks like it's designed to support unbanning multiple nodes with one click, but the GUI doesn't allow me to select multiple entries when I try (unlike in the peertable where banning multiple nodes with one click works).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I noticed the same - looks like we don't need a loop here since it is always just one being selected. But it was like this and I left it as is (with a loop) to minimize the amount of unnecessary changes that can have unexpected adverse effects. I do not know why the GUI wouldn't let me select more than one row. Maybe a change elsewhere in the code would allow that and then this code would be broken without a loop.

Copy link
Member

Choose a reason for hiding this comment

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

to enable it, just need to set the table selection mode to multi selection. e.g. peerTable->setSelectionMode(QAbstractItemView::MultiSelection);.

I didn't mention it because the PR is fine, it is not changing behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, no need to change it here, I just mentioned it because I found it a bit strange and maybe someone would be interested to change it in a follow-up.

@hebasto hebasto changed the title gui: use the stored CSubNet entry when unbanning Use the stored CSubNet entry when unbanning Mar 9, 2023
@hebasto hebasto merged commit 9985013 into bitcoin-core:master Mar 9, 2023
@vasild vasild deleted the gui_unban branch March 9, 2023 13:50
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 9, 2023
4be57a5 gui: fix comments for BanTableModel and BanTablePriv::refreshBanlist() (Vasil Dimov)
a981af4 gui: use the stored CSubNet entry when unbanning (Vasil Dimov)

Pull request description:

  The previous code visualized the `CSubNet` object as string, then parsed that string back to `CSubNet`. This is sub-optimal given that the original `CSubNet` object can be used directly instead.

  This avoids calling `LookupSubNet()` from the GUI.

ACKs for top commit:
  furszy:
    utACK 4be57a5
  mzumsande:
    Tested ACK 4be57a5

Tree-SHA512: b783c18c9d676aa9486cff2d27039dd5c5ef3f1cc67e5056a2be68e35930926f368f26dacdf4f3d394a1f73e3e28f42dc8a6936cd1765c6e6e60695c7b4d78af
Julianabrwon

This comment was marked as spam.

@bitcoin-core bitcoin-core locked and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0