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.
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.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
CSubNet in LookupSubNet by brunoerg)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.
This would simplify https://github.com/bitcoin/bitcoin/pull/27071.
Concept ACK
Would be better to not access the ban model internals from outside, it breaks encapsulation. Could do https://github.com/furszy/bitcoin-gui/commit/81b667efe3a9cc74b04d22d32322ca790f7c0957
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>
utACK 4be57a5d
36 | @@ -37,7 +37,7 @@ class BannedNodeLessThan 37 | }; 38 | 39 | /** 40 | - Qt model providing information about connected peers, similar to the 41 | + Qt model providing information about banned peers, similar to the 42 | "getpeerinfo" RPC call. Used by the rpc console UI.
If this comment is fixed anyway (it was copied from peertablemodel.h), could also replace "getpeerinfo" with "listbanned".
1318 | - { 1319 | - clientModel->getBanTableModel()->refresh(); 1320 | - } 1321 | + BanTableModel* ban_table_model{clientModel->getBanTableModel()}; 1322 | + bool unbanned{false}; 1323 | + for (const auto& node_index : nodes) {
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).
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.
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.
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.
Tested ACK 4be57a5df140f52628cab8a5ca5ddc208cd3f612
I tested that banning and unbanning still works, the code changes look good to me (although I don't know the GUI very well).
13VYk4xFjMN8d3wXnMZzvm8cwBHp3mo3LP