mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge bitcoin/bitcoin#24678: Prevent wallet unload on GetWalletForJSONRPCRequest
f59959e381wallet: Prevent wallet unload on GetWalletForJSONRPCRequest (João Barbosa) Pull request description: Don't extend shared ownership of all wallets to `GetWalletForJSONRPCRequest` scope. ACKs for top commit: achow101: ACKf59959e381shaavan: Code Review ACKf59959e381theStack: Concept and code-review ACKf59959e381Tree-SHA512: 7c0294098b5c32acaab8cc6fcf17a581d580ad1a557ba0602a9506074ac035815739afb4a25b3e61be9132535c7fc3ec7ef5137c1dfc9d4078f13663d508ef55
This commit is contained in:
@@ -149,6 +149,13 @@ std::vector<std::shared_ptr<CWallet>> GetWallets(WalletContext& context)
|
||||
return context.wallets;
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> GetDefaultWallet(WalletContext& context, size_t& count)
|
||||
{
|
||||
LOCK(context.wallets_mutex);
|
||||
count = context.wallets.size();
|
||||
return count == 1 ? context.wallets[0] : nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> GetWallet(WalletContext& context, const std::string& name)
|
||||
{
|
||||
LOCK(context.wallets_mutex);
|
||||
|
||||
Reference in New Issue
Block a user