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

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34147.

    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 <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    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.

  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 🔀

    Signature:

    0untrusted 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}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: review ACK 11ce5cf7997e6d09806dd4e73043afa758810856 🔀
    3a9Qham9/Ya82U/jQU1i/5WpuEpEQSmWQb+cOUGsNLFoBF+V66Of6KlnSF21XvkEB+JYYnhUOIHl3jj5TxsYADA==
    
  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 :)

     0....@...:~/BitcoinCore/bitcoin$ git grep -n IsCrypted
     1src/qt/walletmodel.h:71:        Unencrypted,  // !wallet->IsCrypted()
     2src/qt/walletmodel.h:72:        Locked,       // wallet->IsCrypted() && wallet->IsLocked()
     3src/qt/walletmodel.h:73:        Unlocked      // wallet->IsCrypted() && !wallet->IsLocked()
     4src/wallet/interfaces.cpp:143:    bool isCrypted() override { return m_wallet->IsCrypted(); }
     5src/wallet/interfaces.cpp:626:        if (it != wallets.end()) return (*it)->IsCrypted();
     6src/wallet/rpc/encrypt.cpp:48:        if (!pwallet->IsCrypted()) {
     7src/wallet/rpc/encrypt.cpp:137:    if (!pwallet->IsCrypted()) {
     8src/wallet/rpc/encrypt.cpp:202:    if (!pwallet->IsCrypted()) {
     9src/wallet/rpc/encrypt.cpp:259:    if (pwallet->IsCrypted()) {
    10src/wallet/rpc/wallet.cpp:96:    if (pwallet->IsCrypted()) {
    11src/wallet/wallet.cpp:768:    if (IsCrypted())
    12src/wallet/wallet.cpp:3294:bool CWallet::IsCrypted() const
    13src/wallet/wallet.cpp:3301:    if (!IsCrypted()) {
    14src/wallet/wallet.cpp:3310:    if (!IsCrypted())
    15src/wallet/wallet.cpp:3524:    if (IsCrypted()) {
    16src/wallet/wallet.h:492:    bool IsCrypted() const;
    17src/wallet/wallettool.cpp:101:    tfm::format(std::cout, "Encrypted: %s\n", wallet_instance->IsCrypted() ? "yes" : "no");
    
  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:

    0- bool isCrypted() override { return m_wallet->HasEncryptionKeys(); }
    1+ 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


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-01-02 00:13 UTC

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