diff options
| author | Vasil Dimov <[email protected]> | 2020-05-29 18:49:26 +0200 |
|---|---|---|
| committer | Vasil Dimov <[email protected]> | 2020-05-29 18:49:26 +0200 |
| commit | fbacad1880341ace31f669530c66d4e322d19235 (patch) | |
| tree | 39b4b49f13a0899c3232dd6885980f866afa611f /src/protocol.cpp | |
| parent | Merge #14988: wallet: Fix for confirmed column in csv export for payment to s... (diff) | |
| download | discoin-fbacad1880341ace31f669530c66d4e322d19235.tar.xz discoin-fbacad1880341ace31f669530c66d4e322d19235.zip | |
util: simplify the interface of serviceFlagToStr()
Don't take two redundant arguments in `serviceFlagToStr()`.
As a side effect this fixes an issue introduced in
https://github.com/bitcoin/bitcoin/pull/18165 due to which the GUI could
print something like `UNKNOWN[1033] & UNKNOWN[1033] & UNKNOWN[2^10]`
instead of `NETWORK & WITNESS`.
Diffstat (limited to 'src/protocol.cpp')
| -rw-r--r-- | src/protocol.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp index 737baff36..56071f474 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -195,9 +195,10 @@ const std::vector<std::string> &getAllNetMessageTypes() return allNetMessageTypesVec; } -std::string serviceFlagToStr(const uint64_t mask, const int bit) +std::string serviceFlagToStr(size_t bit) { - switch (ServiceFlags(mask)) { + const uint64_t service_flag = 1ULL << bit; + switch ((ServiceFlags)service_flag) { case NODE_NONE: abort(); // impossible case NODE_NETWORK: return "NETWORK"; case NODE_GETUTXO: return "GETUTXO"; @@ -211,7 +212,7 @@ std::string serviceFlagToStr(const uint64_t mask, const int bit) stream.imbue(std::locale::classic()); stream << "UNKNOWN["; if (bit < 8) { - stream << mask; + stream << service_flag; } else { stream << "2^" << bit; } |