mempool: count unbroadcast txids in memory usage #35923

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/mempool-unbroadcast-memory changing 2 files +18 −1
  1. l0rinc commented at 10:33 PM on August 6, 2026: contributor

    Problem: The mempool memory estimate omits the txid set used to retry the initial broadcast of locally submitted transactions, so getmempoolinfo and -maxmempool undercount retained memory.

    Fix: Count this set when calculating mempool memory usage.

  2. test: characterize unbroadcast memory accounting
    Track a mempool transaction before and after adding its txid to the unbroadcast set, which currently retains a node without changing reported memory usage.
    8d5c4a9290
  3. mempool: include unbroadcast txid memory
    Include `m_unbroadcast_txids` in `DynamicMemoryUsage()` to count the set nodes retained for locally submitted transactions awaiting their first successful broadcast, with at most one entry per mempool transaction.
    db21e03c9d
  4. DrahtBot added the label Mempool on Aug 6, 2026
  5. DrahtBot commented at 10:33 PM on August 6, 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/35923.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK jeanpablojp

    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-->

  6. DrahtBot closed this on Aug 7, 2026

  7. DrahtBot reopened this on Aug 7, 2026

  8. jeanpablojp commented at 1:07 PM on August 8, 2026: contributor

    ACK db21e03c9d50386072a1123568f917ba65dcf348

    I have tested the code. m_unbroadcast_txids is a std::set<Txid> that memusage.h handles, 80 bytes per txid on my build, and it was not counted elsewhere in DynamicMemoryUsage(). Dropping the term makes the added test fail (760 <= 760), so it covers the change. Built the merge with master (05a7c47): unit suite, mempool_unbroadcast.py and mempool_persist.py pass.


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-08-11 09:51 UTC

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