Skip to content

Commit

Permalink
Moved RPC type conversion for usewallet to RPCConvertValues function.
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeShark committed Jan 7, 2013
1 parent 629ca2f commit ebf85b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,15 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "loadwallet" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "loadwallet" && n > 2) ConvertTo<bool>(params[2]);
if (strMethod == "loadwallet" && n > 3) ConvertTo<boost::int64_t>(params[3]);
if (strMethod == "usewallet" && n > 3)
{
vector<string> subStrParams;
for (unsigned int i = 3; i < strParams.size(); i++)
subStrParams.push_back(strParams[i]);

Array subParams = RPCConvertValues(strParams[2], subStrParams);
params.insert(params.begin(), strParams.begin(), strParams.begin() + 2);
}

return params;
}
Expand Down
6 changes: 1 addition & 5 deletions src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,12 +1580,8 @@ Value usewallet(CWallet* pWallet, const Array& params, bool fHelp)

if (!pcmd->isWalletFn)
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Method ") + strMethod + " is not a wallet method.");

vector<string> vstrParams;
for (unsigned int i = 2; i < params.size(); i++)
vstrParams.push_back(params[i].get_str());

return tableRPC.execute(strMethod, RPCConvertValues(strMethod, vstrParams), pWallet);
return tableRPC.execute(strMethod, params, pWallet);
}

Value loadwallet(CWallet* pWallet, const Array& params, bool fHelp)
Expand Down

0 comments on commit ebf85b1

Please sign in to comment.