Skip to content
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

Merged
merged 20 commits into from Sep 22, 2015

Conversation

jonasschnelli
Copy link
Contributor

@jonasschnelli jonasschnelli commented Jun 20, 2015

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:
bildschirmfoto-2015-06-20-um-21 58 44
bildschirmfoto-2015-06-20-um-21 58 59

@@ -527,6 +528,7 @@ UniValue setban(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_MISC_ERROR, "Error: Unban failed");
}

uiInterface.BannedListChanged();
Copy link
Contributor Author

@jonasschnelli jonasschnelli Jun 20, 2015

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?

Copy link

@Diapolo Diapolo Jun 23, 2015

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?

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);
Copy link
Contributor Author

@jonasschnelli jonasschnelli Jun 20, 2015

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.

Copy link

@Diapolo Diapolo Jun 20, 2015

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...

Copy link
Contributor Author

@jonasschnelli jonasschnelli Jun 21, 2015

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!).

Copy link
Contributor Author

@jonasschnelli jonasschnelli Jun 21, 2015

Choose a reason for hiding this comment

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

Found a fix! Pushed.

@Diapolo
Copy link

Diapolo commented Jun 20, 2015

Great pull IMHO, sorry for hitting you hard with that bunch of comments...

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Jun 21, 2015

Thanks @Diapolo for the review. Appricate detailed feedback.
Will fix all your points (especially the miss transaction to fDisconnect!).

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Jun 21, 2015

Prebuilt binaries: https://builds.jonasschnelli.ch/pulls/6315/

}
} else if (role == Qt::TextAlignmentRole) {
if (index.column() == Bantime)
return (int)(Qt::AlignRight | Qt::AlignVCenter);
Copy link

@Diapolo Diapolo Jun 21, 2015

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?

Copy link
Contributor Author

@jonasschnelli jonasschnelli Jun 21, 2015

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).

Copy link

@Diapolo Diapolo Jun 21, 2015

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 :).

@Diapolo
Copy link

Diapolo commented Jun 21, 2015

Currently integrating this into my build to test, will report back :).

@Diapolo
Copy link

Diapolo commented Jun 21, 2015

Observations:

  1. Banning a node, selecting a new node (from connected peers) and then selecting a banned node leaves the details of the previous (not banned) node visible in the right area.
  2. Banning a node selects the first cell in the banlist table without selecting the whole line and without a focus (cell is not marked active). I'd suggest the banned node should be selected and active entirely.
  3. I'm using Tor and hidden-service addresses + netmask + banned until are that large that I'm unable to view the whole values with the default sizes.
  4. The banned peers list has a heading Banned peers, perhaps the connected peers also should get a heading? I'd vote for a much smaller font size, the current one looks rather too big.

Edit:

  1. There is a serious issue with banning incomming connections via Tor, these are all shown as 127.0.0.1 and handling them seems broken.

@Diapolo
Copy link

Diapolo commented Jun 21, 2015

There is also an issue with removing a peer from banned peers list when banned until is over:
ban

The peer should be removed from the list, which is not working currently.

listbanned also still shows them:
[
{
"address": "127.0.0.1/255.255.255.255",
"banned_untill": 1434891295
},
{
"address": "nkf5e6b7pl4jfd4a.onion/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"banned_untill": 1434891291
},
{
"address": "t6xj6wilh4ytvcs7.onion/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"banned_untill": 1434891400
}
]

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Jun 21, 2015

@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.

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Jun 21, 2015

Tested also with Tor nodes. Works fine. @Diapolo: what issues did you encounter with tor nodes?

@laanwj laanwj added the GUI label Jun 22, 2015
@Diapolo
Copy link

Diapolo commented Jun 22, 2015

@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" :).

Philip Kaufmann and others added 7 commits Sep 16, 2015
- 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
@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Sep 16, 2015

Rebased. Travis is happy now.

@jtimon
Copy link
Member

jtimon commented Sep 17, 2015

Concept ACK

@luke-jr
Copy link
Member

luke-jr commented Sep 20, 2015

Why does 7f90ea7 remove the DumpBanlist calls?

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented Sep 20, 2015

Thank @luke-jr for the precise review.
I think this sneaked in over a rebase because this PR started before the banlist was persisted to disk.

Just added a commit that re-implenents the DumpBanlist() calls in case of banning/unbanning over QT.

@luke-jr
Copy link
Member

luke-jr commented Sep 20, 2015

Note I did not do a precise review for this (yet?), just noticed those disappear from the previous version. ;)

@laanwj laanwj merged commit 7aac6db into bitcoin:master Sep 22, 2015
laanwj added a commit that referenced this pull request Sep 22, 2015
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)
@Diapolo
Copy link

Diapolo commented Sep 22, 2015

@laanwj Now if #6371 could be merged, I'd be happy!

zkbot added a commit to zcash/zcash that referenced this pull request Apr 5, 2018
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.
zkbot added a commit to zcash/zcash that referenced this pull request Mar 6, 2020
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.
zkbot added a commit to zcash/zcash that referenced this pull request Nov 11, 2020
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#8392
  - Only the second commit.

Part of #2074.
zkbot added a commit to zcash/zcash that referenced this pull request Nov 12, 2020
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.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 11, 2021
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.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 16, 2021
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.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 17, 2021
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.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 17, 2021
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.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants