net, rpc: Asmap version improvements/follow-ups #36249

pull fjahr wants to merge 6 commits into bitcoin:master from fjahr:2026-09-asmap-ver-followup changing 6 files +53 −23
  1. fjahr commented at 11:46 AM on September 14, 2026: contributor

    This is a follow-up to #36215. I noticed the possible improvement in exportasmap and went through everything to see where else we could make changes where we can use this as an advantage.

    • rpc: Reuse AsmapVersion in exportasmap: exportasmap hashed the file by hand to show the hash, instead we can use AsmapVersion() which is the same value.
    • init: Log asmap version from NetGroupManager: Drop the version variable in init and log the version by getting it from NetGroupManager instead
    • test: Check embedded asmap version log and addrman re-bucketing: We didn't cover rebucketing behavior in the functional test yet. Also gets rid of stale comment.
    • rpc: Add asmap_version to getnetworkinfo: Getting access to the asmap version from the logs may be a bit tedious for some users and now it may be even more interesting for them to compare the version to the hash attested to in asmap-data. So let them get it via getnetworkinfo.
    • doc: Describe how to verify the asmap in use: Just mention the latest changes from above and the opportunity to compare the version to the hash in seen in asmap-data.
  2. rpc: Reuse AsmapVersion in exportasmap fdfd196908
  3. init: Log asmap version from NetGroupManager 0bc87365ca
  4. DrahtBot commented at 11:47 AM on September 14, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36249.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK sedited, willcl-ark
    Stale ACK jurraca

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. test: Check embedded asmap version log and addrman re-bucketing dd5a8a63b2
  6. rpc: Add asmap_version to getnetworkinfo 87ce88c1b5
  7. doc: Describe how to verify the asmap in use c1e9d15406
  8. fjahr force-pushed on Sep 14, 2026
  9. DrahtBot added the label CI failed on Sep 14, 2026
  10. sedited added the label Needs Backport (32.x) on Sep 14, 2026
  11. sedited requested review from jurraca on Sep 14, 2026
  12. DrahtBot removed the label CI failed on Sep 14, 2026
  13. jurraca approved
  14. sedited added this to the milestone 32.0 on Sep 16, 2026
  15. sedited approved
  16. sedited commented at 11:31 AM on September 16, 2026: contributor

    ACK c1e9d15406fb7b46cff1cf385607a3e47fdd1bfb

  17. netgroup: Cache asmap version 0b353a9e87
  18. in src/rpc/net.cpp:774 in c1e9d15406 outdated
     768 | @@ -767,6 +769,10 @@ static RPCMethod getnetworkinfo()
     769 |      obj.pushKV("connections_in", connman.GetNodeCount(ConnectionDirection::In));
     770 |      obj.pushKV("connections_out", connman.GetNodeCount(ConnectionDirection::Out));
     771 |      obj.pushKV("networks",      GetNetworksInfo());
     772 | +    const NetGroupManager& netgroupman{*CHECK_NONFATAL(node.netgroupman)};
     773 | +    if (netgroupman.UsingASMap()) {
     774 | +        obj.pushKV("asmap_version", HexStr(netgroupman.GetAsmapVersion()));
    


    sedited commented at 11:45 AM on September 16, 2026:

    This is fine, but it seems a bit wasteful to re-hash the map on every call. Maybe netgroupman can cache it?


    fjahr commented at 11:51 AM on September 16, 2026:

    Sure, I actually had considered caching it early on but thought it wasn't necessary but that was before I added it to the RPC. It makes more sense to add it when taking all the latest changes into account, let me add it.

  19. fjahr commented at 12:27 PM on September 16, 2026: contributor

    Pushed caching the asmap version in netgroupman as a separate commit. The constructor is moved to netgroup.cpp to avoid importing util/asmap.h into the netgroup header file.

  20. sedited approved
  21. sedited commented at 12:35 PM on September 16, 2026: contributor

    Re-ACK 0b353a9e872e81b900a543d7fedf668be3afec2c

  22. DrahtBot requested review from jurraca on Sep 16, 2026
  23. sedited requested review from willcl-ark on Sep 16, 2026
  24. willcl-ark approved
  25. willcl-ark commented at 7:40 PM on September 17, 2026: member

    ACK 0b353a9e872e81b900a543d7fedf668be3afec2c

    This all LGTM.

    One question I thought of was whether we might ever want to add more asmap info to the RPC responses, and if so perhaps give it a dedicated RPC. That said, I couldn't think of anything else we'd need other than a hash particularly. So I think getnetworkinfo is fine.

  26. sedited merged this on Sep 17, 2026
  27. sedited closed this on Sep 17, 2026

  28. fanquake commented at 9:40 AM on September 18, 2026: member

    Backported to 32.x in #36267.

  29. fanquake removed the label Needs Backport (32.x) on Sep 18, 2026
  30. fanquake referenced this in commit d000de3834 on Sep 18, 2026
  31. fanquake referenced this in commit c6c6fa4374 on Sep 18, 2026
  32. fanquake referenced this in commit edf799b4a0 on Sep 18, 2026
  33. fanquake referenced this in commit c1fb38c3e3 on Sep 18, 2026
  34. fanquake referenced this in commit 04eb5daa07 on Sep 18, 2026
  35. fanquake referenced this in commit e4966be2db on Sep 18, 2026

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-09-22 05:51 UTC

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