-
Notifications
You must be signed in to change notification settings - Fork 353
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
|
|
||
| #include <chainparams.h> | ||
| #include <interfaces/node.h> | ||
| #include <netbase.h> | ||
| #include <qt/bantablemodel.h> | ||
| #include <qt/clientmodel.h> | ||
| #include <qt/guiutil.h> | ||
|
|
@@ -1308,17 +1307,13 @@ void RPCConsole::unbanSelectedNode() | |
|
|
||
| // Get selected ban addresses | ||
| QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->banlistWidget, BanTableModel::Address); | ||
| for(int i = 0; i < nodes.count(); i++) | ||
| { | ||
| // Get currently selected ban address | ||
| QString strNode = nodes.at(i).data().toString(); | ||
| CSubNet possibleSubnet; | ||
|
|
||
| LookupSubNet(strNode.toStdString(), possibleSubnet); | ||
| if (possibleSubnet.IsValid() && m_node.unban(possibleSubnet)) | ||
| { | ||
| clientModel->getBanTableModel()->refresh(); | ||
| } | ||
| BanTableModel* ban_table_model{clientModel->getBanTableModel()}; | ||
| bool unbanned{false}; | ||
| for (const auto& node_index : nodes) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. I didn't mention it because the PR is fine, it is not changing behavior.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| unbanned |= ban_table_model->unban(node_index); | ||
| } | ||
| if (unbanned) { | ||
| ban_table_model->refresh(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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".