test, refactor: Embedded ASMap [1/3]: Selected minor preparatory work #33026

pull fjahr wants to merge 4 commits into bitcoin:master from fjahr:2023-10-asmap-in-source-prep changing 6 files +116 −8
  1. fjahr commented at 9:55 pm on July 20, 2025: contributor

    This contains some commits from #28792 that can be easily reviewed and merged independently. I hope splitting this change off can make this part move a bit faster and reduce frequency of needed rebases for #28792.

    The commits in order:

    • Add additional unit test vectors to the asmap interpreter (written by sipa). This helps to ensure that the further refactors in #28792 don’t change behavior.
    • Modernizes the logging in util/asmap.cpp, I added this while touching the rest of the file all over anyway.
    • Adds an AutoFile::size helper function with some additional test coverage in a separate commit
  2. DrahtBot commented at 9:55 pm on July 20, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hodlinator, laanwj, maflcko
    Stale ACK nervana21, achow101, sipa

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #33878 (refactor, docs: Embedded ASMap [2/3]: Refactor asmap internals and add documentation by fjahr)
    • #31868 ([IBD] specialize block serialization by l0rinc)
    • #29641 (scripted-diff: Use LogInfo over LogPrintf [WIP, NOMERGE, DRAFT] by maflcko)
    • #28792 (build: Embedded ASMap [3/3]: Build binary dump header file by fjahr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. nervana21 commented at 4:02 am on July 24, 2025: contributor

    tACK 942d95d

    I thoroughly reviewed and understood all code changes. I ran the tests locally and they all passed.

  4. fanquake referenced this in commit 16f7b43b68 on Jul 24, 2025
  5. in src/util/asmap.cpp:203 in 942d95d3c6 outdated
    199@@ -200,13 +200,11 @@ std::vector<bool> DecodeAsmap(fs::path path)
    200     FILE *filestr = fsbridge::fopen(path, "rb");
    201     AutoFile file{filestr};
    202     if (file.IsNull()) {
    203-        LogPrintf("Failed to open asmap file from disk\n");
    


    fanquake commented at 10:22 am on July 24, 2025:
    In 9481c77420845316e825855ac589aa8a10bff057: Should drop the redundant \n on all lines.

    fjahr commented at 1:44 pm on July 24, 2025:
    done
  6. in src/common/args.cpp:276 in 942d95d3c6 outdated
    272@@ -273,7 +273,7 @@ fs::path ArgsManager::GetPathArg(std::string arg, const fs::path& default_value)
    273 {
    274     if (IsArgNegated(arg)) return fs::path{};
    275     std::string path_str = GetArg(arg, "");
    276-    if (path_str.empty()) return default_value;
    277+    if (path_str.empty() || path_str == "1") return default_value;
    


    fanquake commented at 10:25 am on July 24, 2025:
    In 74932c62f9627a2eee634b1dd16fe2582c258a74: Seems a bit awkaward to add an (undocumented) special case here for asmap? Can’t we just fail if the value given isn’t a valid path, or stop supporting this behaviour? cc @ryanofsky

    fjahr commented at 1:30 pm on July 24, 2025:
    I can drop this is other reviewers agree that it’s confusing. I personally think this is the more intuitive behavior for path args independently of asmap because our bool args all work with both -foo and -foo=1 afaik. If the user wants to use -asmap (or any path arg) as a bool then I think they would expect it to work the same as the other bool params. Fwiw, I discovered this because I wrote a functional test that covered -asmap=1 and I actually expected it work, only after it didn’t I added this.

    sipa commented at 1:28 pm on October 14, 2025:
    Sounds like we need to agree on what approach to take here before this can move forward?

    fjahr commented at 1:41 pm on October 14, 2025:
    There has been some further discussion on this in #33386 and I wasn’t able to address it yet. I will drop the commit from here and open two separate PRs because there doesn’t seem to be a clear outcome of the discussion yet. One adding the commit here and improving docs and the other splitting asmap= into asmap=/asmapfile= which is certainly the cleaner alternative but changes behavior and it’s a bit messy to redefine behavior of asmap= just slightly.
  7. fjahr force-pushed on Jul 24, 2025
  8. DrahtBot added the label Needs rebase on Jul 25, 2025
  9. fjahr force-pushed on Jul 25, 2025
  10. DrahtBot removed the label Needs rebase on Jul 25, 2025
  11. DrahtBot added the label CI failed on Jul 26, 2025
  12. DrahtBot removed the label CI failed on Jul 26, 2025
  13. sipa commented at 3:30 pm on August 8, 2025: member
    utACK 734737b5930df7cebab83cf0dbe5fd390143f2be
  14. achow101 commented at 8:27 pm on August 27, 2025: member
    ACK 734737b5930df7cebab83cf0dbe5fd390143f2be
  15. fjahr force-pushed on Oct 14, 2025
  16. fjahr commented at 1:43 pm on October 14, 2025: contributor
    No changes except for dropping the contentious change to args behavior.
  17. sipa commented at 1:46 pm on October 14, 2025: member
    ACK 5bb456c92bbd27ebbba1773832b051968f162b8a
  18. DrahtBot requested review from achow101 on Oct 14, 2025
  19. in src/test/netbase_tests.cpp:618 in 5bb456c92b
    610@@ -610,4 +611,55 @@ BOOST_AUTO_TEST_CASE(isbadport)
    611     BOOST_CHECK_EQUAL(std::ranges::count_if(ports, IsBadPort), 85);
    612 }
    613 
    614+
    615+BOOST_AUTO_TEST_CASE(asmap_test_vectors)
    616+{
    617+    // Randomly generated encoded ASMap with 128 ranges, up to 20-bit AS numbers.
    618+    static const auto ASMAP_DATA =
    


    hodlinator commented at 8:41 am on November 10, 2025:

    nit in 5a63a5a1fdf84625c411acb72fa51e12f9a8b067: New code should use more modern constexpr std::bytes (and optionally reserve() vector):

     0 BOOST_AUTO_TEST_CASE(asmap_test_vectors)
     1 {
     2     // Randomly generated encoded ASMap with 128 ranges, up to 20-bit AS numbers.
     3-    static const auto ASMAP_DATA =
     4+    constexpr auto ASMAP_DATA{
     5         "fd38d50f7d5d665357f64bba6bfc190d6078a7e68e5d3ac032edf47f8b5755f87881bfd3633d9aa7c1fa279b3"
     6         "6fe26c63bbc9de44e0f04e5a382d8e1cddbe1c26653bc939d4327f287e8b4d1f8aff33176787cb0ff7cb28e3f"
     7         "daef0f8f47357f801c9f7ff7a99f7f9c9f99de7f3156ae00f23eb27a303bc486aa3ccc31ec19394c2f8a53ddd"
     8@@ -625,13 +625,14 @@ BOOST_AUTO_TEST_CASE(asmap_test_vectors)
     9         "1e3bbc17ba4d6f79ea3f031b876799ac268b1e0ea9babf0f9a8e5f6c55e363c6363df46afc696d7afceaf49b6"
    10         "e62df9e9dc27e70664cafe5c53df66dd0b8237678ada90e73f05ec60e6f6e96c3cbb1ea2f9dece115d5bdba10"
    11         "33e53662a7d72a29477b5beb35710591d3e23e5f0379baea62ffdee535bcdf879cbf69b88d7ea37c8015381cf"
    12-        "63dc33d28f757a4a5e15d6a08"_hex_v_u8;
    13+        "63dc33d28f757a4a5e15d6a08"_hex};
    14 
    15     // Convert to std::vector<bool> format that the ASMap interpreter uses.
    16     std::vector<bool> asmap_bits;
    17+    asmap_bits.reserve(ASMAP_DATA.size() * 8);
    18     for (auto byte : ASMAP_DATA) {
    19         for (int bit = 0; bit < 8; ++bit) {
    20-            asmap_bits.push_back((byte >> bit) & 1);
    21+            asmap_bits.push_back((std::to_integer<uint8_t>(byte) >> bit) & 1);
    22         }
    23     }
    

    fjahr commented at 2:48 pm on November 14, 2025:
    Done
  20. in src/test/streams_tests.cpp:136 in 5bb456c92b
    132@@ -111,6 +133,7 @@ BOOST_AUTO_TEST_CASE(xor_file)
    133 #endif
    134         AutoFile xor_file{raw_file(mode), obfuscation};
    135         xor_file << test1 << test2;
    136+        BOOST_CHECK_EQUAL(xor_file.size(), 14);
    


    hodlinator commented at 9:05 am on November 10, 2025:

    Why do we get 14?

    Tried adding…

    0    {
    1        AutoFile test{raw_file("rb"), obfuscation};
    2        BOOST_CHECK_EQUAL(test.size(), 14);
    3    }
    

    …just after this block before digging into the data but it fails with size() suddenly returning 7 (which would be what we expect: 2 vector compact size bytes + 2+3 bytes of data).


    fjahr commented at 2:48 pm on November 14, 2025:
    That’s a bug, nice find! The line where I had seek(pos, SEEK_END) in the size() implementation should have been seek(0, SEEK_END), this lead to these wrong numbers. In these tests the position was at the end (7) and seek(pos, SEEK_END) moved the pos to EOF plus pos, which was 14. Fixed!
  21. in src/wallet/migrate.cpp:547 in 5bb456c92b
    543@@ -544,8 +544,7 @@ void BerkeleyRODatabase::Open()
    544     page_size = outer_meta.pagesize;
    545 
    546     // Verify the size of the file is a multiple of the page size
    547-    db_file.seek(0, SEEK_END);
    548-    int64_t size = db_file.tell();
    549+    int64_t size{db_file.size()};
    


    hodlinator commented at 9:07 am on November 10, 2025:

    nit:

    0    const int64_t size{db_file.size()};
    

    hodlinator commented at 4:25 pm on November 10, 2025:
    Instead of implementing AutoFile::size(), did you consider using fs::file_size() as we do in a few other places?

    fjahr commented at 2:44 pm on November 14, 2025:
    No, but upon looking into it I think this is still better. The size() function uses the current file handle while file_size() would create a new one which could create race conditions etc.

    fjahr commented at 2:45 pm on November 14, 2025:
    Done
  22. in src/streams.cpp:141 in 5bb456c92b
    136+    // Temporarily save the current position
    137+    int64_t current_pos = tell();
    138+    seek(current_pos, SEEK_END);
    139+    int64_t file_size = tell();
    140+    // Restore the original position
    141+    seek(current_pos, SEEK_SET);
    


    hodlinator commented at 9:09 am on November 10, 2025:
    This last seek() can be removed and all unit tests still pass (259 non-skipped functional tests all passed as well, no failures in my non---extended run), could add a test that covers this so we don’t spawn any mutation testing mutants.

    fjahr commented at 2:45 pm on November 14, 2025:
    Added a more extensive test for this in a new commit.
  23. in src/streams.cpp:131 in 5bb456c92b
    126@@ -127,3 +127,17 @@ size_t DataStream::GetMemoryUsage() const noexcept
    127 {
    128     return sizeof(*this) + memusage::DynamicUsage(vch);
    129 }
    130+
    131+int64_t AutoFile::size()
    


    hodlinator commented at 9:13 am on November 10, 2025:
    nit: Should be moved above DataStream::GetMemoryUsage() so it’s kept together with other AutoFile methods. Maybe after AutoFile::tell to keep some consistency with header file.

    hodlinator commented at 9:16 am on November 10, 2025:
    remark: Good that it is non-const as it is not thread-safe. :+1:

    fjahr commented at 2:44 pm on November 14, 2025:
    Done
  24. in src/test/netbase_tests.cpp:628 in 5bb456c92b
    623+        "df7278be680a73a74c76db4dd910f1d30752c57fe2bc9f079f1a1e1b036c2a69219f11c5e11980a3fa51f4f82"
    624+        "d36373de73b1863a8c27e36ae0e4f705be3d76ecff038a75bc0f92ba7e7f6f4080f1c47c34d095367ecf4406c"
    625+        "1e3bbc17ba4d6f79ea3f031b876799ac268b1e0ea9babf0f9a8e5f6c55e363c6363df46afc696d7afceaf49b6"
    626+        "e62df9e9dc27e70664cafe5c53df66dd0b8237678ada90e73f05ec60e6f6e96c3cbb1ea2f9dece115d5bdba10"
    627+        "33e53662a7d72a29477b5beb35710591d3e23e5f0379baea62ffdee535bcdf879cbf69b88d7ea37c8015381cf"
    628+        "63dc33d28f757a4a5e15d6a08"_hex_v_u8;
    


    hodlinator commented at 4:36 pm on November 10, 2025:

    remark: Tried…

    0₿ printf fd38d50f7d5d665357f64bba6bfc190d6078a7e68e5d3ac032edf47f8b5755f87881bfd3633d9aa7c1fa279b36fe26c63bbc9de44e0f04e5a382d8e1cddbe1c26653bc939d4327f287e8b4d1f8aff33176787cb0ff7cb28e3fdaef0f8f47357f801c9f7ff7a99f7f9c9f99de7f3156ae00f23eb27a303bc486aa3ccc31ec19394c2f8a53dddea3cc56257f3b7e9b1f488be9c1137db823759aa4e071eef2e984aaf97b52d5f88d0f373dd190fe45e06efef1df7278be680a73a74c76db4dd910f1d30752c57fe2bc9f079f1a1e1b036c2a69219f11c5e11980a3fa51f4f82d36373de73b1863a8c27e36ae0e4f705be3d76ecff038a75bc0f92ba7e7f6f4080f1c47c34d095367ecf4406c1e3bbc17ba4d6f79ea3f031b876799ac268b1e0ea9babf0f9a8e5f6c55e363c6363df46afc696d7afceaf49b6e62df9e9dc27e70664cafe5c53df66dd0b8237678ada90e73f05ec60e6f6e96c3cbb1ea2f9dece115d5bdba1033e53662a7d72a29477b5beb35710591d3e23e5f0379baea62ffdee535bcdf879cbf69b88d7ea37c8015381cf63dc33d28f757a4a5e15d6a08 \
    1| xxd -r -p | ./contrib/asmap/asmap-tool.py decode
    

    …which gives the following output…

     0::/7 AS961340
     1200::/7 AS693761
     2400::/6 AS379835
     3900::/8 AS231066
     4c00::/6 AS216064
     51000::/9 AS66046
     61080::/9 AS601879
     71200::/7 AS672176
     81400::/8 AS943262
     91500::/8 AS902718
    101600::/7 AS52631
    111c00::/6 AS499880
    122000::/7 AS916337
    132400::/7 AS17255
    142600::/7 AS48586
    152800::/11 AS618608
    162820::/11 AS80370
    172840::/12 AS615085
    182850::/12 AS585696
    192860::/11 AS162102
    202880::/10 AS494024
    2128c0::/11 AS982192
    2228e0::/12 AS610253
    2328f0::/12 AS1015065
    242900::/8 AS527255
    252b00::/9 AS393256
    262c00::/12 AS279418
    272c10::/14 AS146709
    282c18::/13 AS317296
    292c20::/11 AS576731
    302c40::/12 AS943095
    312c50::/13 AS100713
    322c58::/13 AS522520
    332c60::/12 AS461149
    342c80::/13 AS15272
    352c88::/13 AS297645
    362ca0::/13 AS433935
    372ca8::/13 AS633894
    382cb0::/12 AS987819
    392cc0::/11 AS770287
    402ce0::/12 AS747699
    412cf0::/12 AS622442
    422d00::/9 AS464074
    432d84::/14 AS1034916
    442d88::/14 AS637424
    452d8c::/15 AS602497
    462d8e::/15 AS1995
    472d90::/12 AS202022
    482da0::/13 AS688185
    492da8::/13 AS148562
    502db0::/17 AS444111
    512db0:8000::/17 AS728945
    522db2::/15 AS123659
    532db8::/15 AS626395
    542dba::/15 AS340438
    552dbc::/16 AS609886
    562dbd::/16 AS417213
    572dc0::/12 AS16298
    582dd0::/12 AS735128
    592de0::/12 AS506083
    602df0::/13 AS436493
    612e40::/10 AS500584
    622e80::/11 AS991607
    632ee0::/11 AS925272
    642f00::/9 AS707739
    652f80::/9 AS328114
    664000::/5 AS248495
    675000::/7 AS124471
    685200::/7 AS539993
    695400::/6 AS374443
    705800::/5 AS999782
    716000::/5 AS407935
    726800::/5 AS435070
    737000::/4 AS677580
    748000::/4 AS244121
    759000::/4 AS862116
    76a000::/9 AS863404
    77a100::/9 AS245226
    78a180::/11 AS915050
    79a1c0::/11 AS811862
    80a400::/7 AS824696
    81a600::/7 AS384156
    82a800::/7 AS150135
    83aa40::/10 AS862795
    84aa80::/9 AS276407
    85ac20::/11 AS171508
    86ac40::/11 AS22548
    87ac60::/11 AS405134
    88ac80::/10 AS1011589
    89acc0::/10 AS998011
    90ad00::/9 AS451326
    91ad80::/9 AS16307
    92ae00::/8 AS1022594
    93af00::/9 AS257981
    94b000::/5 AS475471
    95c000::/3 AS969411
    96e000::/3 AS824019
    

    …which corresponds to the GetMappedAS() responses tested below. 👍

  25. hodlinator commented at 7:55 am on November 11, 2025: contributor

    Reviewed 5bb456c92bbd27ebbba1773832b051968f162b8a

    Thanks for providing a less intimidating PR as a stepping stone for reviewers new to this domain like myself.


    PR description still mentions 4 commits but only 3 are currently present (after #33026 (review)).

  26. tests: add unit test vectors for asmap interpreter 606a251e0a
  27. refactor: Modernize logging in util/asmap.cpp ec0f75862e
  28. refactor: Add AutoFile::size b7af960eb8
  29. test: Add better coverage for Autofile size()
    The new test explicitly checks that the function does not change the current position.
    7f318e1dd0
  30. in src/util/asmap.cpp:203 in 5bb456c92b
    199@@ -200,13 +200,11 @@ std::vector<bool> DecodeAsmap(fs::path path)
    200     FILE *filestr = fsbridge::fopen(path, "rb");
    201     AutoFile file{filestr};
    202     if (file.IsNull()) {
    203-        LogPrintf("Failed to open asmap file from disk\n");
    204+        LogInfo("Failed to open asmap file from disk");
    


    hodlinator commented at 7:56 pm on November 13, 2025:
    Shouldn’t this and the one below be LogWarning to clearly highlight that something is wrong?

    fjahr commented at 2:41 pm on November 14, 2025:
    Seems reasonable, done.
  31. fjahr force-pushed on Nov 14, 2025
  32. fjahr commented at 2:53 pm on November 14, 2025: contributor
    Addressed all feedback from @hodlinator , thanks for the review!
  33. hodlinator approved
  34. hodlinator commented at 8:39 pm on November 14, 2025: contributor

    tACK 7f318e1dd0496384e7bc6d8754c5a2a618a14b2a

    Happy to have helped uncover a bug (https://github.com/bitcoin/bitcoin/pull/33026#discussion_r2527777820). Thanks for incorporating my suggestions! New commit with size_preserves_position-test looks good, I especially like how it verifies that one can ask for size at the end bug not read without triggering an exception.

    Started looking at #28792 and agree this is a reasonable subset of changes to peel off (although I would also consider peeling off bits->bytes refactor and span-usage to its own PR).

  35. DrahtBot requested review from sipa on Nov 14, 2025
  36. fjahr commented at 8:33 pm on November 15, 2025: contributor

    although I would also consider peeling off bits->bytes refactor and span-usage to its own PR

    It’s a good idea, I will take it especially because I have been working on improved documentation for the asmap internals and this would go along nicely with this part of the original PR, I think. Since I started this restructuring yesterday already I will push this soon without your latest review here addressed: #28792#pullrequestreview-3448784895 (thank you for that!). I will address it asap when I have entangled the commit and structured the PRs that hopefully works better for reviewers. I will also revive the asmap tracking issue to provide a better overview again.

  37. fjahr renamed this:
    test, refactor: Embedded ASmap selected preparatory work
    test, refactor: Embedded ASMap [1/3]: Selected minor preparatory work
    on Nov 15, 2025
  38. laanwj approved
  39. laanwj commented at 12:34 pm on November 17, 2025: member
    Code review ACK 7f318e1dd0496384e7bc6d8754c5a2a618a14b2a These are some straightforward changes that even make sense outside the context of embedded ASmap.
  40. waketraindev commented at 2:15 pm on November 17, 2025: contributor

    I think the AutoFile::size implementation and the subsequent refactoring would fit better in their own dedicated refactoring PR, or in a PR where they’re actually required. They don’t seem to be needed by either of the other two commits (the LogWarning change in asmap.cpp or the newly added test vectors in netbase_tests.cpp).

    I understand this is listed as “selected minor preparatory work”, and I realize this is nitpicking a bit, but it would still be cleaner to introduce these changes in a PR where they’re actually used or needed, or in a dedicated Streams refactoring PR. For that matter, they already appear to be included in #33878 as well as in #28792. The need for this refactor in the current asmap change set also seems fairly low, since it only removes ~3 lines of seek & tell from asmap.cpp while touching files that aren’t directly related to the asmap work here (e.g., src/wallet/migrate.cpp, src/streams.{cpp,h}).

    Just to double-check, I tested the netbase_tests.cpp changes with the AutoFile::size commits removed, and everything still passed:

    0*** No errors detected
    
  41. in src/test/netbase_tests.cpp:636 in 7f318e1dd0
    631+    std::vector<bool> asmap_bits;
    632+    asmap_bits.reserve(ASMAP_DATA.size() * 8);
    633+    for (auto byte : ASMAP_DATA) {
    634+        for (int bit = 0; bit < 8; ++bit) {
    635+            asmap_bits.push_back((std::to_integer<uint8_t>(byte) >> bit) & 1);
    636+        }
    


    waketraindev commented at 5:08 pm on November 17, 2025:
    0        const uint8_t value = std::to_integer<uint8_t>(byte);
    1        for (int bit = 0; bit < 8; ++bit) {
    2            asmap_bits.push_back((value >> bit) & 1);
    3        }
    

    Extract value so the std::to_integer cast is only called once per byte instead of once per bit.


    maflcko commented at 8:18 am on November 18, 2025:
    The call should be fully optimized out anyway, no?

    waketraindev commented at 11:32 am on November 18, 2025:

    The call should be fully optimized out anyway, no?

    I sure hope so! It’s test-only code, so not a big deal.


    fjahr commented at 11:26 pm on November 18, 2025:
    I will address this if I have to retouch

    maflcko commented at 8:03 am on November 19, 2025:
    Maybe just de-duplicate with FromBytes in the other test file?
  42. fjahr commented at 11:59 pm on November 18, 2025: contributor

    I think the AutoFile::size implementation and the subsequent refactoring would fit better in their own dedicated refactoring PR, or in a PR where they’re actually required. They don’t seem to be needed by either of the other two commits (the LogWarning change in asmap.cpp or the newly added test vectors in netbase_tests.cpp).

    Most of our refactoring commits are not “actually required”, strictly speaking. We still do them for a variety of reasons. In this case, I was working on the asmap implementation code for a while and this piece of it always jumped out at me as a layer violation. It seemed like this kind of file handling functionality should live in a helper function in a different part of the code base. So that’s what I did. I probably still hadn’t done it if there had been no deduplication opportunity at all, but at least there was one. And an additional benefit is having the function also allows for testing of this functionality in isolation.

    I understand this is listed as “selected minor preparatory work”, and I realize this is nitpicking a bit, but it would still be cleaner to introduce these changes in a PR where they’re actually used or needed, or in a dedicated Streams refactoring PR. For that matter, they already appear to be included in #33878 as well as in #28792. The need for this refactor in the current asmap change set also seems fairly low, since it only removes ~3 lines of seek & tell from asmap.cpp while touching files that aren’t directly related to the asmap work here (e.g., src/wallet/migrate.cpp, src/streams.{cpp,h}).

    The code is used in asmap and the major benefit IMO is that there is no code that doesn’t really belong in the asmap implementation distracting from the actual meat there. While the impact might be minor it can still help because a lot of people (myself included) have struggled with the review of this code. And direct usage is the usual requirement we have for including refactorings in a feature PR afaict unless things become too big or a separate conceptual discussion is required. I think the extend of this is fine in the in terms of LOC and the other files it touches. So I will not move this out because practically speaking there are now two active and three stale acks here plus there has been prior review of this in #28792. Pulling this out, looking for another PR to include this in or putting it into it’s own PR would create too much friction and distract more from moving asmap forward than keeping it here. It’s true that we generally want smaller, focussed PRs but we also shouldn’t overdo this and in this case I fall on having these changes bundled here is still the best way to go.

  43. in src/test/streams_tests.cpp:839 in 7f318e1dd0
    834+    // Pos still at 4
    835+    BOOST_CHECK_EQUAL(middle, 4);
    836+
    837+    // Case: Pos at EOF
    838+    f.seek(0, SEEK_END);
    839+    (void)f.size();
    


    maflcko commented at 8:01 am on November 19, 2025:
    nit: Here and above in the last commit: Why not check the size is equal to 10 each time?
  44. maflcko commented at 8:03 am on November 19, 2025: member

    review ACK 7f318e1dd0496384e7bc6d8754c5a2a618a14b2a 🏀

    Signature:

    0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: review ACK 7f318e1dd0496384e7bc6d8754c5a2a618a14b2a 🏀
    3qGU0O/Xt8gMYBoNtn62IqHA1sHMs521slcneeOyWGCUCwaK+ecZIxJqkA8KE2Me4oXQYMEbULV8ZLQpRc834AQ==
    
  45. fanquake merged this on Nov 19, 2025
  46. fanquake closed this on Nov 19, 2025

  47. maflcko commented at 9:37 am on November 19, 2025: member
    forgot to send the nits, basically just a test nit to check the returned size, but just a nit
  48. fjahr commented at 1:18 pm on November 19, 2025: contributor

    forgot to send the nits, basically just a test nit to check the returned size, but just a nit

    Thanks, I will check if I can address these in one of the asmap follow-up PRs.


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: 2025-11-28 03:13 UTC

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