diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-05-29 11:06:03 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-05-29 11:06:08 +0200 |
commit | de369c7ea57745fbbbab5c7ba3ec8ab48f9e3ec5 (patch) | |
tree | e3a6a18be726bc347d7386aa144d07f22cd7c5b9 /src/qt | |
parent | f4b603cff63aea798a55e7a129edf8324f8e19b1 (diff) | |
parent | c31bc5bcfddf440e9a1713f7ba2ca2bf9cfa8e2e (diff) |
Merge #18165: Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function
c31bc5bcfddf440e9a1713f7ba2ca2bf9cfa8e2e Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function (Luke Dashjr)
cea91a1e40e12029140ebfba969ce3ef2965029c Bugfix: GUI: Use unsigned long long type to avoid implicit conversion of MSB check (Luke Dashjr)
Pull request description:
Side effect: this results in the RPC showing unknown service bits as "UNKNOWN[n]" like the GUI.
Note that there is no common mask-to-`vector<string>` function because both GUI and RPC would need to iterate through it to convert to their desired target formats.
ACKs for top commit:
jonasschnelli:
utACK ~~cea91a1e40e12029140ebfba969ce3ef2965029c~~ c31bc5bcfddf440e9a1713f7ba2ca2bf9cfa8e2e
Tree-SHA512: 32c7ba8ac7ef2d4087f4f317447ae93a328ec9fb9ad81301df2fbaeeb21a3db7a503187a369552b05a9414251b7cf8e15bcde74c1ea2ef36591ea7ffb6721f60
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/guiutil.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 4afec1b474..e78e400f07 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -751,33 +751,15 @@ QString formatDurationStr(int secs) return strList.join(" "); } -QString serviceFlagToStr(const quint64 mask, const int bit) -{ - switch (ServiceFlags(mask)) { - case NODE_NONE: abort(); // impossible - case NODE_NETWORK: return "NETWORK"; - case NODE_GETUTXO: return "GETUTXO"; - case NODE_BLOOM: return "BLOOM"; - case NODE_WITNESS: return "WITNESS"; - case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED"; - // Not using default, so we get warned when a case is missing - } - if (bit < 8) { - return QString("%1[%2]").arg("UNKNOWN").arg(mask); - } else { - return QString("%1[2^%2]").arg("UNKNOWN").arg(bit); - } -} - QString formatServicesStr(quint64 mask) { QStringList strList; for (int i = 0; i < 64; i++) { - uint64_t check = 1LL << i; + uint64_t check = 1ull << i; if (mask & check) { - strList.append(serviceFlagToStr(check, i)); + strList.append(QString::fromStdString(serviceFlagToStr(mask, i))); } } |