-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr #17474
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
Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr #17474
Conversation
c124bc9
to
4341bff
Compare
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.
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 |
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.
// 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 |
// Not using default, so we get warned when a case is missing | ||
} |
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.
Could it follow Developer Notes?
// 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); |
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.
Why do bits >=8
get 2^
but <8
don't?
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.
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.
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.
(Also because 9223372036854775808 is a pretty big number)
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.
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.
utACK 4341bff |
Tested ACK 4341bff |
…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
…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
…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
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
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.