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.
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-
promag commented at 9:35 PM on June 12, 2020: member
- promag cross-referenced this on Jun 12, 2020 from issue wallet: Make RPC help compile-time static by MarcoFalke
-
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()) {MarcoFalke approvedMarcoFalke commented at 9:52 PM on June 12, 2020: memberACK
DrahtBot added the label Refactoring on Jun 12, 2020DrahtBot added the label RPC/REST/ZMQ on Jun 12, 2020DrahtBot added the label Wallet on Jun 12, 2020refactor: Drop ::HasWallets() ccf1f6ea24promag force-pushed on Jun 13, 2020in 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_walletsnow?
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.
MarcoFalke commented at 11:34 AM on June 13, 2020: memberACK ccf1f6ea24905876f35e685204cb2293cf083e97
MarcoFalke closed this on Jun 13, 2020MarcoFalke reopened this on Jun 13, 2020MarcoFalke removed the label RPC/REST/ZMQ on Jun 13, 2020MarcoFalke removed the label Wallet on Jun 13, 2020hebasto approvedhebasto commented at 1:26 PM on June 13, 2020: memberACK ccf1f6ea24905876f35e685204cb2293cf083e97, I have reviewed the changes and they look OK, I agree they can be merged.
MarcoFalke merged this on Jun 13, 2020MarcoFalke closed this on Jun 13, 2020sidhujag referenced this in commit f308262ced on Jun 14, 2020ryanofsky cross-referenced this on Jun 19, 2020 from issue refactor: remove ::vpwallets and related global variables by ryanofskyFabcien referenced this in commit d66b0479d4 on Apr 29, 2021bitcoin 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
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