private broadcast: bound memory use of broadcast attempts #35680

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:2026-07-bound_private_mem changing 8 files +244 −155
  1. instagibbs commented at 8:12 PM on July 7, 2026: member

    Rather than scale the memory usage with the total number attempts per tx to recompute necessary statistics, directly track the necessary information, leaving us with memory usage in-line with number of active peer connections and outstanding private relay txs.

    Do note that this means per-peer statistics will be lost on that specific peer's disconnection.

    Waiting for #35090 to be merged and I will rebase on top of it, but taking directional (N)ACKs now

  2. DrahtBot commented at 8:12 PM on July 7, 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/35680.

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

    • #33922 (mining: add getMemoryLoad() and track template non-mempool memory footprint by Sjors)

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

  3. fanquake added the label Private Broadcast on Jul 7, 2026
  4. private broadcast: bound memory use of broadcast attempts
    Rather than scale the memory usage with the total number
    attempts per tx to recompute necessary statistics, directly
    track the necessary information, leaving us with memory
    usage in-line with number of active peer connections and
    outstanding private relay txs.
    85d109a3ef
  5. instagibbs force-pushed on Jul 7, 2026
  6. DrahtBot added the label CI failed on Jul 7, 2026
  7. DrahtBot removed the label CI failed on Jul 7, 2026
  8. fanquake commented at 8:56 AM on July 8, 2026: member
  9. in src/rpc/mempool.cpp:165 in 85d109a3ef
     159 | @@ -160,7 +160,9 @@ static RPCMethod getprivatebroadcastinfo()
     160 |                                  {RPCResult::Type::STR_HEX, "wtxid", "The transaction witness hash in hex"},
     161 |                                  {RPCResult::Type::STR_HEX, "hex", "The serialized, hex-encoded transaction data"},
     162 |                                  {RPCResult::Type::NUM_TIME, "time_added", "The time this transaction was added to the private broadcast queue (seconds since epoch)"},
     163 | -                                {RPCResult::Type::ARR, "peers", "Per-peer send and acknowledgment information for this transaction",
     164 | +                                {RPCResult::Type::NUM, "num_sent", "Total number of peers this transaction was sent to so far"},
     165 | +                                {RPCResult::Type::NUM, "num_acknowledged", "Total number of peers that acknowledged reception of this transaction"},
     166 | +                                {RPCResult::Type::ARR, "peers", "Per-peer send and acknowledgment information for this transaction, for currently connected peers only",
    


    andrewtoth commented at 1:46 PM on July 8, 2026:

    If we make this change, is it worth reporting this? It will only have a value for max 3 minutes, and the received field will only ever have a value for a tiny amount of time that will require racing between receiving the PONG and disconnecting.

    If we don't think we should store this data for stats a la #34707, we should remove these fields IMO. If we think they're valuable, we should instead cap this to last ~3 peers instead and just truncate the vector as we make more connections.


    instagibbs commented at 5:26 PM on July 8, 2026:

    A limited buffer of disconnected peer stats, in addition to all the live ones, could make sense, if that's what you're suggesting


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-07-09 06:47 UTC