-
Notifications
You must be signed in to change notification settings - Fork 36.5k
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
[Qt] allow banning and unbanning over UI->peers table #6315
Conversation
@@ -527,6 +528,7 @@ UniValue setban(const UniValue& params, bool fHelp) | |||
throw JSONRPCError(RPC_MISC_ERROR, "Error: Unban failed"); | |||
} | |||
|
|||
uiInterface.BannedListChanged(); |
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.
I'm not sure if the locking of a signal emit is done within boost::signal of if this needs explicit locking of uiInterface
?
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.
Perhaps @laanwj can comment on this?
2233f12
to
b5621fa
Compare
case Bantime: | ||
//show time in users local timezone, not 64bit compatible! | ||
//TODO find a way to support 64bit timestamps | ||
boost::posix_time::ptime pt1 = boost::posix_time::from_time_t(rec->bantil); |
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.
i recognized that boost::posix_time::from_time_t
is not 64bit capable. Maybe someone has a idea how to fix this.
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.
What about QDateTime::fromTime_t()
?
QDateTime::fromTime_t(rec->bantil).toString()
didn't test it...
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.
I think this won't work either. The docs are saying: QDateTime QDateTime::fromTime_t(uint seconds)
(uint!).
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.
Found a fix! Pushed.
Great pull IMHO, sorry for hitting you hard with that bunch of comments... |
Thanks @Diapolo for the review. Appricate detailed feedback. |
Prebuilt binaries: https://builds.jonasschnelli.ch/pulls/6315/ |
} | ||
} else if (role == Qt::TextAlignmentRole) { | ||
if (index.column() == Bantime) | ||
return (int)(Qt::AlignRight | Qt::AlignVCenter); |
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.
Still the question: Is int
the right type here? I tried (QVariant)
which also works and is more the Qt style?
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.
Right. This is also the same as we have it in PeersTableModel, it works, but i agree that it should be QVariant (as the method definition says).
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.
I opened #6317 and will try to keep that in sync with what we are doing here :).
Currently integrating this into my build to test, will report back :). |
Observations:
Edit:
|
@Diapolo: for autocleaning then ban list see PR #6310 I think you point 1) is not a problem. The peer is still selected (gray) when you interact with the bantable. Point 2) and 3) are cosmetics and should not hold this PR back. Point 4) agreed. Banning tor nodes needs testing (best first over RPC) and maybe needs more implementation. Would be good if you could see what's missing there. |
Tested also with Tor nodes. Works fine. @Diapolo: what issues did you encounter with tor nodes? |
@jonasschnelli The problem are incoming Tor nodes with 127.0.0.1 blocking one connected node blocks any other incoming 127.0.0.1 node. Other connected 127.0.0.1 are not affected. Also I'd suggest splitting of the autocleaning pull from the disk-store-pull as autocleaning is uncontroversial and also needed by this one. I also disagree on ignoring UI or UX issues for now as often such "small" or "minor" things are just forgotton or I pick them up. I'd vote for making this pull good and not just "working okay" :). |
114c722
to
f75b590
Compare
- add missing NULL pointer checks - add better comments and reorder some code in rpcconsole.cpp - remove unneeded leftovers in bantable.cpp - update bantable column sizes to prevent cutting of banned until
- 1 (h)our - 1 (d)ay - 1 (w)eek - 1 (y)ear
- this matches RPC call behaviour
897ff84
to
7f90ea7
Compare
Rebased. Travis is happy now. |
Concept ACK |
Why does 7f90ea7 remove the DumpBanlist calls? |
Thank @luke-jr for the precise review. Just added a commit that re-implenents the |
Note I did not do a precise review for this (yet?), just noticed those disappear from the previous version. ;) |
7aac6db [QT] dump banlist to disk in case of ban/unban over QT (Jonas Schnelli) 7f90ea7 [QA] adabt QT_NO_KEYWORDS for QT ban implementation (Jonas Schnelli) 07f70b2 [QA] fix netbase tests because of new CSubNet::ToString() output (Jonas Schnelli) 4ed0510 [Qt] call DumpBanlist() when baning unbaning nodes (Philip Kaufmann) be89292 [Qt] reenabling hotkeys for ban context menu, use different words (Jonas Schnelli) b1189cf [Qt] adapt QT ban option to banlist.dat changes (Jonas Schnelli) 65abe91 [Qt] add sorting for bantable (Philip Kaufmann) 51654de [Qt] bantable polish (Philip Kaufmann) cdd72cd [Qt] simplify ban list signal handling (Philip Kaufmann) 43c1f5b [Qt] remove unused timer-code from banlistmodel.cpp (Jonas Schnelli) e2b8028 net: Fix CIDR notation in ToString() (Wladimir J. van der Laan) 9e521c1 [Qt] polish ban table (Philip Kaufmann) 607809f net: use CIDR notation in CSubNet::ToString() (Jonas Schnelli) 53caec6 [Qt] bantable overhaul (Jonas Schnelli) f0bcbc4 [Qt] bantable fix timestamp 64bit issue (Jonas Schnelli) 6135309 [Qt] banlist, UI optimizing and better signal handling (Jonas Schnelli) 770ca79 [Qt] add context menu with unban option to ban table (Jonas Schnelli) 5f42132 [Qt] add ui signal for banlist changes (Jonas Schnelli) ad204df [Qt] add banlist table below peers table (Jonas Schnelli) 50f0908 [Qt] add ban functions to peers window (Jonas Schnelli)
banlist.dat: store banlist on disk Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6310 - bitcoin/bitcoin#6315 - Only the new signal and net changes, no QT - bitcoin/bitcoin#7350 - bitcoin/bitcoin#7458 Part of #2074.
banlist.dat: store banlist on disk Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6310 - bitcoin/bitcoin#6315 - Only the new signal and net changes, no QT. - bitcoin/bitcoin#7350 - bitcoin/bitcoin#7458 - bitcoin/bitcoin#7696 - bitcoin/bitcoin#7959 - bitcoin/bitcoin#7906 - Only the ban-related commits. - bitcoin/bitcoin#8392 - Only the second commit. - bitcoin/bitcoin#8085 - Only the second commit. - bitcoin/bitcoin#10564 Part of #2074.
banlist.dat: store banlist on disk Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6310 - bitcoin/bitcoin#6315 - Only the new signal and net changes, no QT. - bitcoin/bitcoin#7350 - bitcoin/bitcoin#7458 - bitcoin/bitcoin#7696 - bitcoin/bitcoin#7959 - bitcoin/bitcoin#7906 - Only the ban-related commits. - bitcoin/bitcoin#8392 - Only the second commit. - bitcoin/bitcoin#8085 - Only the second commit. - bitcoin/bitcoin#10564 Part of #2074.
banlist.dat: store banlist on disk Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6310 - bitcoin/bitcoin#6315 - Only the new signal and net changes, no QT. - bitcoin/bitcoin#7350 - bitcoin/bitcoin#7458 - bitcoin/bitcoin#7696 - bitcoin/bitcoin#7959 - bitcoin/bitcoin#7906 - Only the ban-related commits. - bitcoin/bitcoin#8392 - Only the second commit. - bitcoin/bitcoin#8085 - Only the second commit. - bitcoin/bitcoin#10564 - bitcoin/bitcoin#13061 - Wasn't needed when I first made this backport in 2017, but it is now! Part of #2074.
banlist.dat: store banlist on disk Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6310 - bitcoin/bitcoin#6315 - Only the new signal and net changes, no QT. - bitcoin/bitcoin#7350 - bitcoin/bitcoin#7458 - bitcoin/bitcoin#7696 - bitcoin/bitcoin#7959 - bitcoin/bitcoin#7906 - Only the ban-related commits. - bitcoin/bitcoin#8392 - Only the second commit. - bitcoin/bitcoin#8085 - Only the second commit. - bitcoin/bitcoin#10564 - bitcoin/bitcoin#13061 - Wasn't needed when I first made this backport in 2017, but it is now! Part of #2074.
This adds 4 ban options to the peers tables context menu (1h, 24h, 7d, 365d). If there are active bans, a table with banned subnets will be shown.
Sync between the rpc bans and the ui bans are guaranteed over a new
uiInterface
signal.Screenshots: