refactor: Drop ::HasWallets() #19261

pull promag wants to merge 1 commits into bitcoin:master from promag:2020-06-drop-has-wallets changing 3 files +1 −8
  1. promag commented at 9:35 PM on June 12, 2020: member

    Minor follow-up of #19250. The global HasWallets() is used only once and at the call site there's already a way to know if any wallet is loaded.

  2. promag cross-referenced this on Jun 12, 2020 from issue wallet: Make RPC help compile-time static by MarcoFalke
  3. in src/wallet/rpcwallet.cpp:109 in d85c6da5d2 outdated
     105 | @@ -106,7 +106,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
     106 |          return wallets[0];
     107 |      }
     108 |  
     109 | -    if (!HasWallets()) {
     110 | +    if (wallets.size() == 0) {
    


    MarcoFalke commented at 9:52 PM on June 12, 2020:
        if (wallets.empty()) {
    
  4. MarcoFalke approved
  5. MarcoFalke commented at 9:52 PM on June 12, 2020: member

    ACK

  6. DrahtBot added the label Refactoring on Jun 12, 2020
  7. DrahtBot added the label RPC/REST/ZMQ on Jun 12, 2020
  8. DrahtBot added the label Wallet on Jun 12, 2020
  9. refactor: Drop ::HasWallets() ccf1f6ea24
  10. promag force-pushed on Jun 13, 2020
  11. in src/wallet/rpcwallet.cpp:109 in ccf1f6ea24
     105 | @@ -106,7 +106,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
     106 |          return wallets[0];
     107 |      }
     108 |  
     109 | -    if (!HasWallets()) {
     110 | +    if (wallets.empty()) {
    


    hebasto commented at 4:59 AM on June 13, 2020:

    Why it is safe do not lock cs_wallets now?


    MarcoFalke commented at 11:32 AM on June 13, 2020:

    I presume for the same reason that it is safe to return wallets[0] without the lock. cs_wallets only protects vpwallets, not copies of the shared pointers.

  12. MarcoFalke commented at 11:34 AM on June 13, 2020: member

    ACK ccf1f6ea24905876f35e685204cb2293cf083e97

  13. MarcoFalke closed this on Jun 13, 2020

  14. MarcoFalke reopened this on Jun 13, 2020

  15. MarcoFalke removed the label RPC/REST/ZMQ on Jun 13, 2020
  16. MarcoFalke removed the label Wallet on Jun 13, 2020
  17. hebasto approved
  18. hebasto commented at 1:26 PM on June 13, 2020: member

    ACK ccf1f6ea24905876f35e685204cb2293cf083e97, I have reviewed the changes and they look OK, I agree they can be merged.

  19. MarcoFalke merged this on Jun 13, 2020
  20. MarcoFalke closed this on Jun 13, 2020

  21. sidhujag referenced this in commit f308262ced on Jun 14, 2020
  22. ryanofsky cross-referenced this on Jun 19, 2020 from issue refactor: remove ::vpwallets and related global variables by ryanofsky
  23. Fabcien referenced this in commit d66b0479d4 on Apr 29, 2021
  24. bitcoin locked this on Feb 15, 2022

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-05-20 06:54 UTC