scripted-diff: refactor: wallet: Delete duplicate IsCrypted() #34147

pull davidgumberg wants to merge 1 commits into bitcoin:master from davidgumberg:2025-12-24-delete-iscrypted changing 7 files +15 −21
  1. davidgumberg commented at 7:11 PM on December 24, 2025: contributor

    This function is a duplicate of HasEncryptionKeys().

  2. scripted-diff: refactor: wallet: Delete IsCrypted
    This function is a duplicate of HasEncryptionKeys().
    
    -BEGIN VERIFY SCRIPT-
    sed -i '/bool IsCrypted() const;/d' src/wallet/wallet.h
    sed -i '/^bool CWallet::IsCrypted() const$/,/^}$/{/^}$/N;d;}' src/wallet/wallet.cpp
    sed -i --regexp-extended 's/IsCrypted\(\)/HasEncryptionKeys()/g' $(git ls-files '*.cpp' '*.h')
    -END VERIFY SCRIPT-
    11ce5cf799
  3. DrahtBot added the label Refactoring on Dec 24, 2025
  4. DrahtBot commented at 7:12 PM on December 24, 2025: 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/34147.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, billymcbip, polespinasa, rkrux

    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.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #28333 (wallet: Construct ScriptPubKeyMans with all data rather than loaded progressively by achow101)
    • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)

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

  5. maflcko commented at 8:56 AM on December 25, 2025: member

    lgtm.

    i think the command size can be reduced by replacing the ls-files with git grep -l IsCrypted, but the command passes, so this is not required.

    review ACK 11ce5cf7997e6d09806dd4e73043afa758810856 🔀

    <details><summary>Show signature</summary>

    Signature:

    untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    trusted comment: review ACK 11ce5cf7997e6d09806dd4e73043afa758810856 🔀
    a9Qham9/Ya82U/jQU1i/5WpuEpEQSmWQb+cOUGsNLFoBF+V66Of6KlnSF21XvkEB+JYYnhUOIHl3jj5TxsYADA==
    

    </details>

  6. billymcbip commented at 9:37 AM on December 25, 2025: contributor

    utACK 11ce5cf

  7. polespinasa approved
  8. polespinasa commented at 9:41 AM on December 25, 2025: member

    code review tACK 11ce5cf7997e6d09806dd4e73043afa758810856

    The existence of IsCrypted() made sense in the past as it had a unique behaviour but since https://github.com/bitcoin/bitcoin/pull/17369/changes/bf6417142f36a2f75b3a11368bd73fe788ae1ccb it just wrappes HasEncryptionKeys()

    The script provided works. Bc there are not many changes did a simple manual double check and it matches :)

    <details>

    ....@...:~/BitcoinCore/bitcoin$ git grep -n IsCrypted
    src/qt/walletmodel.h:71:        Unencrypted,  // !wallet->IsCrypted()
    src/qt/walletmodel.h:72:        Locked,       // wallet->IsCrypted() && wallet->IsLocked()
    src/qt/walletmodel.h:73:        Unlocked      // wallet->IsCrypted() && !wallet->IsLocked()
    src/wallet/interfaces.cpp:143:    bool isCrypted() override { return m_wallet->IsCrypted(); }
    src/wallet/interfaces.cpp:626:        if (it != wallets.end()) return (*it)->IsCrypted();
    src/wallet/rpc/encrypt.cpp:48:        if (!pwallet->IsCrypted()) {
    src/wallet/rpc/encrypt.cpp:137:    if (!pwallet->IsCrypted()) {
    src/wallet/rpc/encrypt.cpp:202:    if (!pwallet->IsCrypted()) {
    src/wallet/rpc/encrypt.cpp:259:    if (pwallet->IsCrypted()) {
    src/wallet/rpc/wallet.cpp:96:    if (pwallet->IsCrypted()) {
    src/wallet/wallet.cpp:768:    if (IsCrypted())
    src/wallet/wallet.cpp:3294:bool CWallet::IsCrypted() const
    src/wallet/wallet.cpp:3301:    if (!IsCrypted()) {
    src/wallet/wallet.cpp:3310:    if (!IsCrypted())
    src/wallet/wallet.cpp:3524:    if (IsCrypted()) {
    src/wallet/wallet.h:492:    bool IsCrypted() const;
    src/wallet/wallettool.cpp:101:    tfm::format(std::cout, "Encrypted: %s\n", wallet_instance->IsCrypted() ? "yes" : "no");
    

    </details>

  9. in src/wallet/interfaces.cpp:143 in 11ce5cf799
     139 | @@ -140,7 +140,7 @@ class WalletImpl : public Wallet
     140 |      {
     141 |          return m_wallet->EncryptWallet(wallet_passphrase);
     142 |      }
     143 | -    bool isCrypted() override { return m_wallet->IsCrypted(); }
     144 | +    bool isCrypted() override { return m_wallet->HasEncryptionKeys(); }
    


    rkrux commented at 8:19 AM on December 26, 2025:

    Many method names in WalletImpl have the same words as in the method names of CWallet, so along the same lines:

    - bool isCrypted() override { return m_wallet->HasEncryptionKeys(); }
    + bool hasEncryptionKeys() override { return m_wallet->HasEncryptionKeys(); } 
    
  10. rkrux commented at 8:21 AM on December 26, 2025: contributor

    crACK 11ce5cf7997e6d09806dd4e73043afa758810856

    Suggested a rename of a function used in GUI but looks fine as-is as well.

  11. fanquake merged this on Dec 27, 2025
  12. fanquake closed this on Dec 27, 2025

  13. sedited referenced this in commit f8db928648 on Dec 27, 2025
  14. joshdoman referenced this in commit 57661ceac9 on Dec 27, 2025
  15. stickies-v referenced this in commit 9fa736f8e4 on Jan 22, 2026
  16. stringintech referenced this in commit 67e0422ca0 on Feb 2, 2026
  17. Kino1994 referenced this in commit cdf11be52c on Jun 28, 2026
  18. BigcoinBGC referenced this in commit 0159783251 on Jun 30, 2026
  19. Kino1994 referenced this in commit b9ea47603d on Aug 19, 2026
  20. lanewreachoutinc-boop commented at 3:58 AM on November 14, 2026: none

    Add to wallet


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-11-30 03:51 UTC

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