wallet: remove unused code #36127

pull jeanpablojp wants to merge 5 commits into bitcoin:master from jeanpablojp:wallet-remove-unused changing 9 files +3 −31
  1. jeanpablojp commented at 1:04 PM on August 31, 2026: contributor

    Five unused items in src/wallet, one per commit.

    DescriptorScriptPubKeyMan::AddDescriptorKey, a private wrapper that lost its caller in #28333.

    COutput::ToString, no callers. It was used by COutput::print(), which went away with the other print() methods in wallet.

    The two CHDChain keypool index members, whose last uses went away with LegacySPKM in #28710.

    WalletDatabase::m_refcount. Only BDB ever maintained it, and BDB went away in #28710.

    The warnings parameter of CreateFromDump, never written, along with the loop that printed it in wallet-tool. The push_back went away with the -format option in #31250.

  2. wallet: remove unused DescriptorScriptPubKeyMan::AddDescriptorKey
    The private method has no callers. It opened a `WalletBatch` and
    forwarded to `AddDescriptorKeyWithDB`, which is still called from two
    other places.
    
    Its last caller, in `CWallet::AddWalletDescriptor`, was replaced in
    aa4f7823aa ("wallet: include keys when constructing DescriptorSPKM
    during import"), which builds the manager with `CreateFromMigration`
    instead of adding the key afterwards.
    a0e9aac428
  3. wallet: remove unused COutput::ToString
    No callers. It was used by `COutput::print()`, which was removed in
    3802224110 ("Remove all other print() methods").
    4afc7bc40d
  4. wallet: remove unused CHDChain keypool index members
    `m_next_external_index` and `m_next_internal_index` are declared and
    initialized and never read or written afterwards. Their last uses were
    removed in 83af1a3cca ("wallet: Delete LegacySPKM"). Neither appears in
    `SERIALIZE_METHODS` or in `SetNull`.
    f64b3fa70f
  5. wallet: remove unused WalletDatabase::m_refcount
    The counter is never incremented. Only the BDB implementation ever
    maintained it, and that went away in 04a7a7a28c ("build, wallet, doc:
    Remove BDB"). `AddRef()` and `RemoveRef()`, which the comment above the
    member describes as maintaining it, were removed in c0f3f3264f
    ("wallet: Remove unused db functions"), leaving the member behind.
    2f6aa41d3d
  6. wallet: remove unused warnings parameter from CreateFromDump
    `CreateFromDump` never writes to the vector, so the loop that prints it
    in wallet-tool cannot produce output. `tool_wallet.py` already asserts
    empty output for `createfromdump`.
    
    The only `warnings.push_back()` was removed in 7a41c939f0 ("wallet:
    Remove -format and bdb from wallet tool's createfromdump").
    bbed824a64
  7. DrahtBot added the label Wallet on Aug 31, 2026
  8. DrahtBot commented at 1:04 PM on August 31, 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/36127.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK pablomartin4btc

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

  9. pablomartin4btc commented at 6:10 PM on August 31, 2026: member

    ACK bbed824a64f0a5335442261b3abd63db22453cd6

    Clean removal, verified every symbol's references.

    Found one more piece of unused code that would make a natural 6th commit for the PR — these 2 data members in struct DatabaseOptions:

    bool use_shared_memory = false; //!< Let other processes access the database.
    int64_t max_log_mb = 100;       //!< Max log size to allow before consolidating.
    

    Both use_shared_memory and max_log_mb were last actually consumed in 04a7a7a28c — part of the merge for PR #28710, the same PR the existing commits already cite for the m_next_* and m_refcount removals.


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

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