aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2016-09-22 09:46:41 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2016-10-19 14:42:08 +0200
commit69d1c25768a8649bfc7eb8e9c35b8fe9874ac9fc (patch)
tree88c4ef2720fc4e88d080c6fc480c341bf118a985 /src/rpc/misc.cpp
parent23c32a9694e119f957c124f4501294ae7a5fd99a (diff)
downloadbitcoin-69d1c25768a8649bfc7eb8e9c35b8fe9874ac9fc.tar.xz
[RPC] Give RPC commands more information about the RPC request
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r--src/rpc/misc.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 6bbb3925dd..eaef4856b3 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -39,9 +39,9 @@ using namespace std;
*
* Or alternatively, create a specific query method for the information.
**/
-UniValue getinfo(const UniValue& params, bool fHelp)
+UniValue getinfo(const JSONRPCRequest& request)
{
- if (fHelp || params.size() != 0)
+ if (request.fHelp || request.params.size() != 0)
throw runtime_error(
"getinfo\n"
"\nDEPRECATED. Returns an object containing various state info.\n"
@@ -148,9 +148,9 @@ public:
};
#endif
-UniValue validateaddress(const UniValue& params, bool fHelp)
+UniValue validateaddress(const JSONRPCRequest& request)
{
- if (fHelp || params.size() != 1)
+ if (request.fHelp || request.params.size() != 1)
throw runtime_error(
"validateaddress \"bitcoinaddress\"\n"
"\nReturn information about the given bitcoin address.\n"
@@ -181,7 +181,7 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
LOCK(cs_main);
#endif
- CBitcoinAddress address(params[0].get_str());
+ CBitcoinAddress address(request.params[0].get_str());
bool isValid = address.IsValid();
UniValue ret(UniValue::VOBJ);
@@ -278,9 +278,9 @@ CScript _createmultisig_redeemScript(const UniValue& params)
return result;
}
-UniValue createmultisig(const UniValue& params, bool fHelp)
+UniValue createmultisig(const JSONRPCRequest& request)
{
- if (fHelp || params.size() < 2 || params.size() > 2)
+ if (request.fHelp || request.params.size() < 2 || request.params.size() > 2)
{
string msg = "createmultisig nrequired [\"key\",...]\n"
"\nCreates a multi-signature address with n signature of m keys required.\n"
@@ -310,7 +310,7 @@ UniValue createmultisig(const UniValue& params, bool fHelp)
}
// Construct using pay-to-script-hash:
- CScript inner = _createmultisig_redeemScript(params);
+ CScript inner = _createmultisig_redeemScript(request.params);
CScriptID innerID(inner);
CBitcoinAddress address(innerID);
@@ -321,9 +321,9 @@ UniValue createmultisig(const UniValue& params, bool fHelp)
return result;
}
-UniValue verifymessage(const UniValue& params, bool fHelp)
+UniValue verifymessage(const JSONRPCRequest& request)
{
- if (fHelp || params.size() != 3)
+ if (request.fHelp || request.params.size() != 3)
throw runtime_error(
"verifymessage \"bitcoinaddress\" \"signature\" \"message\"\n"
"\nVerify a signed message\n"
@@ -346,9 +346,9 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
LOCK(cs_main);
- string strAddress = params[0].get_str();
- string strSign = params[1].get_str();
- string strMessage = params[2].get_str();
+ string strAddress = request.params[0].get_str();
+ string strSign = request.params[1].get_str();
+ string strMessage = request.params[2].get_str();
CBitcoinAddress addr(strAddress);
if (!addr.IsValid())
@@ -375,9 +375,9 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
return (pubkey.GetID() == keyID);
}
-UniValue signmessagewithprivkey(const UniValue& params, bool fHelp)
+UniValue signmessagewithprivkey(const JSONRPCRequest& request)
{
- if (fHelp || params.size() != 2)
+ if (request.fHelp || request.params.size() != 2)
throw runtime_error(
"signmessagewithprivkey \"privkey\" \"message\"\n"
"\nSign a message with the private key of an address\n"
@@ -395,8 +395,8 @@ UniValue signmessagewithprivkey(const UniValue& params, bool fHelp)
+ HelpExampleRpc("signmessagewithprivkey", "\"privkey\", \"my message\"")
);
- string strPrivkey = params[0].get_str();
- string strMessage = params[1].get_str();
+ string strPrivkey = request.params[0].get_str();
+ string strMessage = request.params[1].get_str();
CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(strPrivkey);
@@ -417,9 +417,9 @@ UniValue signmessagewithprivkey(const UniValue& params, bool fHelp)
return EncodeBase64(&vchSig[0], vchSig.size());
}
-UniValue setmocktime(const UniValue& params, bool fHelp)
+UniValue setmocktime(const JSONRPCRequest& request)
{
- if (fHelp || params.size() != 1)
+ if (request.fHelp || request.params.size() != 1)
throw runtime_error(
"setmocktime timestamp\n"
"\nSet the local time to given timestamp (-regtest only)\n"
@@ -437,8 +437,8 @@ UniValue setmocktime(const UniValue& params, bool fHelp)
// in a long time.
LOCK(cs_main);
- RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
- SetMockTime(params[0].get_int64());
+ RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM));
+ SetMockTime(request.params[0].get_int64());
uint64_t t = GetTime();
if(g_connman) {