wallet, rpc: accept an array of txids in removeprunedfunds #35660

pull ArikShalom wants to merge 1 commits into bitcoin:master from ArikShalom:2026-07-removeprunedfunds-array changing 4 files +58 −10
  1. ArikShalom commented at 6:18 PM on July 5, 2026: none

    Closes #29466.

    removeprunedfunds only accepted a single txid, but the underlying CWallet::RemoveTxs already takes a vector and performs the removal in one atomic db transaction. This PR lets the RPC accept an array of txids so many transactions can be removed in a single wallet db transaction. A single txid string remains supported for backwards compatibility (via ParamFormat::JSON_OR_STRING in the bitcoin-cli conversion table, following the getblockstats hash_or_height precedent).

    This adopts and reworks #29468 (by leo-aa88, credited as co-author) and addresses the feedback given there and in #32501:

    • Backwards compatibility (raised in #29468): a plain string is still accepted, both positionally and as a named argument. The argument is renamed txidtxids; keeping a txid alias is not possible because rpc_help.py enforces that arguments named txid are plain strings API-wide.

    • Performance justification (requested in #29468): benchmarked on regtest (macOS 26, arm64, SQLite wallet), removing imported pruned-funds transactions:

      | method | N=250 | N=1000 | |---|---|---| | individual RPC calls | 0.031s | 0.129s | | one JSON-RPC batch of individual calls | 0.011s | 0.048s | | one array call (this PR) | 0.001s | 0.005s |

      The JSON-RPC batch row addresses the "just use batch RPC calls" alternative raised in #29468: batching requests removes HTTP overhead, but the server still runs one wallet db txn per call — per the discussion in #29466, wallet db writes cannot be batched by batching RPC requests. The gains grow with wallet size and disk sync cost.

    • Atomicity documented and tested: RemoveTxs runs within one db txn, so if any txid cannot be removed, none are. The functional test covers this (a failing array leaves the other transactions in place), plus empty-array and invalid-hex errors, and the legacy single-string form.

    Testing done: wallet_importprunedfunds.py, wallet_resendwallettransactions.py, and rpc_help.py pass locally; all bitcoin-cli forms exercised manually (bare string, array of two, named txids=, empty array, invalid hex).

    🤖 Generated with Claude Code

  2. wallet, rpc: accept an array of txids in removeprunedfunds
    CWallet::RemoveTxs already takes a vector of txids and performs the
    removal in a single atomic db txn, but the RPC only accepted one txid,
    costing one wallet db transaction per removed transaction. Accept an
    array as well, so many transactions can be removed in one batch. For
    1000 transactions this is ~24x faster than individual RPC calls and
    ~9x faster than a JSON-RPC batch of individual calls.
    
    A single txid passed as a string remains supported. The argument is
    renamed from "txid" to "txids".
    
    fixes #29466
    
    Co-authored-by: Leonardo Araujo <leonardo.aa88@gmail.com>
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    fdb8502b4e
  3. DrahtBot commented at 6:18 PM on July 5, 2026: contributor

    ♻️ Automatically closing for now based on heuristics. Please leave a comment, if this was erroneous. Generally, please focus on creating high-quality, original content that demonstrates a clear understanding of the project's requirements and goals.

    📝 Moderators: If this is spam, please replace the title with ., so that the thread does not appear in search results.

  4. DrahtBot closed this on Jul 5, 2026

  5. DrahtBot commented at 6:18 PM on July 5, 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/35660.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. ArikShalom commented at 6:18 PM on July 5, 2026: none

    @furszy you offered in #29466 to review whenever a PR was open — tagging as requested.


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