test, bench: construct mempool inputs/outputs declaratively #36694

pull alexanderwiederin wants to merge 3 commits into bitcoin:master from alexanderwiederin:declarative-mempool changing 3 files +132 −155
  1. alexanderwiederin commented at 3:04 PM on October 29, 2026: contributor

    Part of #36692. This keeps CMutableTransaction as the builder, since a CTransaction constructor taking inputs and outputs directly is still under discussion. Once one exists, these call sites can be converted to construct CTransaction directly.

    This PR covers the mempool-related files.

    This change is test- and bench-only and does not change the constructed transactions.

    Notes for reviewers: two spots in rbf_tests that modify an existing transaction as part of the test logic are intentionally left unchanged.

  2. test: construct mempool_tests inputs/outputs declaratively
    Replace the field-by-field construction of inputs and outputs in
    mempool_tests with COutPoint, CTxIn and CTxOut constructor calls.
    
    The txChild loop variable in MempoolRemoveTest is changed to uint32_t to
    avoid a narrowing conversion in COutPoint{}. The constructed
    transactions are unchanged.
    b7abd88f0f
  3. bench: construct mempool_eviction inputs/outputs declaratively
    Replace the field-by-field construction of inputs and outputs in
    MempoolEviction with COutPoint, CTxIn and CTxOut constructor calls.
    
    Since CTxIn has no witness constructor argument, the witnesses are added
    after vin is replaced. The constructed transactions are unchanged.
    e56fbbfe5d
  4. test: construct rbf_tests make_tx inputs/outputs declaratively
    Replace resizing the vectors and assigning fields by index in make_tx
    with appending constructed CTxIn and CTxOut elements. The witness is
    added directly to the new input instead of through a temporary
    CScriptWitness. The constructed transactions are unchanged.
    30ad3ca75d
  5. DrahtBot commented at 3:05 PM on October 29, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36521 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36521.svg"></sub> (Keep witness stacks in serialized form in CScriptWitness by sipa)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. in src/bench/mempool_eviction.cpp:42 in 30ad3ca75d
      39 | @@ -40,85 +40,79 @@ static void MempoolEviction(benchmark::Bench& bench)
      40 |      const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
      41 |  
      42 |      CMutableTransaction tx1 = CMutableTransaction();
    


    maflcko commented at 4:23 PM on October 29, 2026:
        CMutableTransaction tx1{};
    

    nit: There is no need to type the type twice. But depending on the outcome of #36692, this may be stale anyway. Let's wait a week or two on that issue.

    Also, this pull conflicts with #36521, so let's wait for that to be merged first.


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-10-30 15:51 UTC

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