File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 40
40
41
41
static const std::string WALLET_ENDPOINT_BASE = " /wallet/" ;
42
42
43
- std::shared_ptr<CWallet> GetWalletForJSONRPCRequest (const JSONRPCRequest& request)
43
+ bool GetWalletNameFromJSONRPCRequest (const JSONRPCRequest& request, std::string& wallet_name )
44
44
{
45
45
if (request.URI .substr (0 , WALLET_ENDPOINT_BASE.size ()) == WALLET_ENDPOINT_BASE) {
46
46
// wallet endpoint was used
47
- std::string requestedWallet = urlDecode (request.URI .substr (WALLET_ENDPOINT_BASE.size ()));
48
- std::shared_ptr<CWallet> pwallet = GetWallet (requestedWallet);
47
+ wallet_name = urlDecode (request.URI .substr (WALLET_ENDPOINT_BASE.size ()));
48
+ return true ;
49
+ }
50
+ return false ;
51
+ }
52
+
53
+ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest (const JSONRPCRequest& request)
54
+ {
55
+ std::string wallet_name;
56
+ if (GetWalletNameFromJSONRPCRequest (request, wallet_name)) {
57
+ std::shared_ptr<CWallet> pwallet = GetWallet (wallet_name);
49
58
if (!pwallet) throw JSONRPCError (RPC_WALLET_NOT_FOUND, " Requested wallet does not exist or is not loaded" );
50
59
return pwallet;
51
60
}
You can’t perform that action at this time.
0 commit comments