Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr #17474

pull luke-jr wants to merge 2 commits into bitcoin:master from luke-jr:bugfix_gui_netlimited_svcbit+refactor changing 2 files +22 −20
  1. luke-jr commented at 4:57 AM on November 14, 2019: member

    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.

  2. Bugfix: GUI: Recognise NETWORK_LIMITED in formatServicesStr df77de8c21
  3. GUI: Refactor formatServicesStr to warn when a ServicesFlag is missing 4341bffb6e
  4. luke-jr force-pushed on Nov 14, 2019
  5. fanquake added the label GUI on Nov 14, 2019
  6. in src/protocol.h:248 in 4341bffb6e
     244 | @@ -245,6 +245,7 @@ const std::vector<std::string> &getAllNetMessageTypes();
     245 |  
     246 |  /** nServices flags */
     247 |  enum ServiceFlags : uint64_t {
     248 | +    // NOTE: When adding here, be sure to update qt/guiutil.cpp's formatServicesStr too
    


    hebasto commented at 6:43 AM on November 14, 2019:
        // NOTE: When adding here, be sure to update qt/guiutil.cpp's serviceFlagToStr too
    
  7. in src/qt/guiutil.cpp:828 in 4341bffb6e
     823 | +    case NODE_GETUTXO:         return "GETUTXO";
     824 | +    case NODE_BLOOM:           return "BLOOM";
     825 | +    case NODE_WITNESS:         return "WITNESS";
     826 | +    case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
     827 | +    // Not using default, so we get warned when a case is missing
     828 | +    }
    


    hebasto commented at 6:50 AM on November 14, 2019:

    Could it follow Developer Notes?

        } // no default case, so the compiler can warn about missing cases
    
  8. hebasto changes_requested
  9. hebasto commented at 6:51 AM on November 14, 2019: member

    Concept ACK 4341bffb6ef10909f3721329db27c5dc9bc720dd

  10. in src/qt/guiutil.cpp:841 in 4341bffb6e
     839 |  
     840 | -    // Just scan the last 8 bits for now.
     841 | -    for (int i = 0; i < 8; i++) {
     842 | -        uint64_t check = 1 << i;
     843 | +    for (int i = 0; i < 64; i++) {
     844 | +        uint64_t check = 1LL << i;
    


    Empact commented at 11:06 AM on November 14, 2019:

    nit: Could do the following, which may be more straightforward:

    for (uint64_t check = 1; check; check = check << 1) {
    

    luke-jr commented at 1:46 PM on November 14, 2019:

    Then we don't have the bit number, and would need to calculate it (which is more complex than the inverse).

  11. in src/qt/guiutil.cpp:832 in 4341bffb6e
     827 | +    // Not using default, so we get warned when a case is missing
     828 | +    }
     829 | +    if (bit < 8) {
     830 | +        return QString("%1[%2]").arg("UNKNOWN").arg(mask);
     831 | +    } else {
     832 | +        return QString("%1[2^%2]").arg("UNKNOWN").arg(bit);
    


    laanwj commented at 11:48 AM on November 14, 2019:

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


    luke-jr commented at 1:46 PM on November 14, 2019:

    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.


    luke-jr commented at 1:48 PM on November 14, 2019:

    (Also because 9223372036854775808 is a pretty big number)


    laanwj commented at 2:36 PM on November 14, 2019:

    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.

  12. jonasschnelli commented at 10:52 PM on November 15, 2019: contributor

    utACK 4341bffb6ef10909f3721329db27c5dc9bc720dd

  13. jonasschnelli commented at 11:02 PM on November 15, 2019: contributor

    Tested ACK 4341bffb6ef10909f3721329db27c5dc9bc720dd

    <img width="1332" alt="Bildschirmfoto 2019-11-15 um 12 59 29" src="https://user-images.githubusercontent.com/178464/68981634-2aab7000-07a8-11ea-90c8-8b3ea5570855.png">

  14. MarkLTZ referenced this in commit e4cc83d5c2 on Nov 17, 2019
  15. MarcoFalke referenced this in commit 5948398b18 on Dec 11, 2019
  16. MarcoFalke merged this on Dec 11, 2019
  17. MarcoFalke closed this on Dec 11, 2019

  18. sidhujag referenced this in commit fcd671c524 on Dec 12, 2019
  19. sidhujag referenced this in commit 7a5133c560 on Nov 10, 2020
  20. jasonbcox referenced this in commit 4a70e0886a on Nov 25, 2020
  21. kittywhiskers referenced this in commit 27ec235a73 on Aug 22, 2021
  22. kittywhiskers referenced this in commit f529b9776e on Aug 22, 2021
  23. kittywhiskers referenced this in commit 407336aa07 on Sep 16, 2021
  24. kittywhiskers referenced this in commit d77b68f34c on Sep 18, 2021
  25. UdjinM6 referenced this in commit 4ffd42de63 on Sep 21, 2021
  26. thelazier referenced this in commit 5b9feebcc7 on Sep 25, 2021
  27. kittywhiskers referenced this in commit 3d59c848f5 on Oct 12, 2021
  28. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me