Skip to content

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 14, 2019

Currently, only the bottom 8 service bits are shown in the GUI peer details view.

NODE_NETWORK_LIMITED is the 11th bit (2^10).

The first commit expands the range to cover the full 64 bits, and properly label "NETWORK_LIMITED".
The second commit refactors the code so that any future omitted service bits will trigger a compile warning.

@luke-jr luke-jr force-pushed the bugfix_gui_netlimited_svcbit+refactor branch from c124bc9 to 4341bff Compare November 14, 2019 05:02
@fanquake fanquake added the GUI label Nov 14, 2019
Copy link
Member

@hebasto hebasto 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 4341bff

@@ -245,6 +245,7 @@ const std::vector<std::string> &getAllNetMessageTypes();

/** nServices flags */
enum ServiceFlags : uint64_t {
// NOTE: When adding here, be sure to update qt/guiutil.cpp's formatServicesStr too
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// NOTE: When adding here, be sure to update qt/guiutil.cpp's formatServicesStr too
// NOTE: When adding here, be sure to update qt/guiutil.cpp's serviceFlagToStr too

Comment on lines +827 to +828
// Not using default, so we get warned when a case is missing
}
Copy link
Member

Choose a reason for hiding this comment

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

Could it follow Developer Notes?

Suggested change
// Not using default, so we get warned when a case is missing
}
} // no default case, so the compiler can warn about missing cases

if (bit < 8) {
return QString("%1[%2]").arg("UNKNOWN").arg(mask);
} else {
return QString("%1[2^%2]").arg("UNKNOWN").arg(bit);
Copy link
Member

Choose a reason for hiding this comment

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

Why do bits >=8 get 2^ but <8 don't?

Copy link
Member Author

Choose a reason for hiding this comment

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

To use the same values that were shown previously for such bits. I'm assuming eventually we'll have all 8 assigned to literal strings, and the special case can go away then.

Copy link
Member Author

Choose a reason for hiding this comment

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

(Also because 9223372036854775808 is a pretty big number)

Copy link
Member

@laanwj laanwj Nov 14, 2019

Choose a reason for hiding this comment

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

OH! I get it now.
But personally I'd show 2^X for all bits then from now on, there's no need for complete version to version consistency in the GUI, and the bit number is generally more useful anyhow.

@jonasschnelli
Copy link
Contributor

utACK 4341bff

@jonasschnelli
Copy link
Contributor

Tested ACK 4341bff

Bildschirmfoto 2019-11-15 um 12 59 29

MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Nov 17, 2019
maflcko pushed a commit that referenced this pull request Dec 11, 2019
…sStr

4341bff GUI: Refactor formatServicesStr to warn when a ServicesFlag is missing (Luke Dashjr)
df77de8 Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr (Luke Dashjr)

Pull request description:

  Currently, only the bottom 8 service bits are shown in the GUI peer details view.

  `NODE_NETWORK_LIMITED` is the 11th bit (2^10).

  The first commit expands the range to cover the full 64 bits, and properly label `"NETWORK_LIMITED"`.
  The second commit refactors the code so that any future omitted service bits will trigger a compile warning.

ACKs for top commit:
  jonasschnelli:
    utACK 4341bff
  jonasschnelli:
    Tested ACK 4341bff
  hebasto:
    Concept ACK 4341bff

Tree-SHA512: 8338737d03fbcd92024159aabd7e632d46e13c72436d935b504d2bf7ee92b7d124e89a5917bf64d51c87f12a64de703270c2d7b4c6711fa8ed08ea7887d817c7
@maflcko maflcko merged commit 4341bff into bitcoin:master Dec 11, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 12, 2019
…ServicesStr

4341bff GUI: Refactor formatServicesStr to warn when a ServicesFlag is missing (Luke Dashjr)
df77de8 Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr (Luke Dashjr)

Pull request description:

  Currently, only the bottom 8 service bits are shown in the GUI peer details view.

  `NODE_NETWORK_LIMITED` is the 11th bit (2^10).

  The first commit expands the range to cover the full 64 bits, and properly label `"NETWORK_LIMITED"`.
  The second commit refactors the code so that any future omitted service bits will trigger a compile warning.

ACKs for top commit:
  jonasschnelli:
    utACK 4341bff
  jonasschnelli:
    Tested ACK 4341bff
  hebasto:
    Concept ACK 4341bff

Tree-SHA512: 8338737d03fbcd92024159aabd7e632d46e13c72436d935b504d2bf7ee92b7d124e89a5917bf64d51c87f12a64de703270c2d7b4c6711fa8ed08ea7887d817c7
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
…ServicesStr

4341bff GUI: Refactor formatServicesStr to warn when a ServicesFlag is missing (Luke Dashjr)
df77de8 Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr (Luke Dashjr)

Pull request description:

  Currently, only the bottom 8 service bits are shown in the GUI peer details view.

  `NODE_NETWORK_LIMITED` is the 11th bit (2^10).

  The first commit expands the range to cover the full 64 bits, and properly label `"NETWORK_LIMITED"`.
  The second commit refactors the code so that any future omitted service bits will trigger a compile warning.

ACKs for top commit:
  jonasschnelli:
    utACK 4341bff
  jonasschnelli:
    Tested ACK 4341bff
  hebasto:
    Concept ACK 4341bff

Tree-SHA512: 8338737d03fbcd92024159aabd7e632d46e13c72436d935b504d2bf7ee92b7d124e89a5917bf64d51c87f12a64de703270c2d7b4c6711fa8ed08ea7887d817c7
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 25, 2020
Summary:
Backport of core [[bitcoin/bitcoin#17474 | PR17474]].

This has been adapted to match our codebase changes from core.
It introduces one change to the way the unknown service bits are displayed,
to make them consistenly display as a bit number. This matches what core does
when the backports are up-to-date and makes the code simpler.

Test Plan:
  ninja check

  ./src/qt/bitcoin-qt
Check the service bit display correctly.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8516
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 16, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 18, 2021
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 12, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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.

7 participants