fuzz: Fix timeout in `txorphan` #35289

pull marcofleon wants to merge 1 commits into bitcoin:master from marcofleon:2026/05/fix-txorphan-timeout changing 1 files +4 −0
  1. marcofleon commented at 1:42 PM on May 14, 2026: contributor

    The EraseForBlock branch in the txorphan harness could produce a block with 1000 transactions in it, each with potentially up to 200,000 inputs, resulting in way too many map lookups. This was producing inputs that were taking 2 seconds or longer per iteration, which is too long.

    Fix by only adding transactions to the block up to the block weight limit. This matches production behavior, as EraseForBlock is only called on a newly connected block.

  2. fuzz: Fix txorphan timeout by limiting block weight 004a7e3cfb
  3. DrahtBot added the label Fuzzing on May 14, 2026
  4. DrahtBot commented at 1:42 PM on May 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/35289.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, sedited, instagibbs

    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. marcofleon commented at 1:47 PM on May 14, 2026: contributor

    Can be tested by running the harness on this input: txorphan-timeout.txt

    FUZZ=txorphan ./fuzzbuild/bin/fuzz txorphan-timeout.txt
    

    On master, it should take more than 2 seconds and with this PR significantly less.

    Here's the flamegraph:

    <img width="1200" height="406" alt="solution-6d51c5dbc793ebfce64809c2546ba34baf05bdd4" src="https://github.com/user-attachments/assets/5ab65615-6096-4581-b785-faba59d89f07" />

  6. maflcko commented at 2:33 PM on May 14, 2026: member

    lgtm ACK 004a7e3cfbc5b2118536651d2201cf8b72c87736

  7. fanquake added the label Needs Backport (31.x) on May 14, 2026
  8. sedited approved
  9. sedited commented at 3:11 PM on May 14, 2026: contributor

    ACK 004a7e3cfbc5b2118536651d2201cf8b72c87736

  10. instagibbs commented at 3:14 PM on May 14, 2026: member

    ACK 004a7e3cfbc5b2118536651d2201cf8b72c87736

    Don't love "EraseForBlock" but this seems more realistic at least

  11. sedited merged this on May 14, 2026
  12. sedited closed this on May 14, 2026

  13. fanquake referenced this in commit 7a97580997 on May 14, 2026
  14. fanquake removed the label Needs Backport (31.x) on May 14, 2026
  15. fanquake commented at 3:50 PM on May 14, 2026: member

    Backported to 31.x in #35231.

  16. nervana21 commented at 3:48 PM on May 15, 2026: contributor

    post-merge tACK 004a7e3cfbc5b2118536651d2201cf8b72c87736

    I used txorphan-timeout.txt and ran: FUZZ=txorphan build_fuzz/bin/fuzz -runs=1 fuzz_input/

    Prior to this patch:

    Done 2 runs in 10 second(s)
    
    real    0m11.047s
    user    0m10.505s
    sys     0m0.165s
    
    

    After applying this patch:

    Done 2 runs in 0 second(s)
    
    real    0m0.907s
    user    0m0.260s
    sys     0m0.193s
    

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-05-19 06:51 UTC