|
|
@ -160,6 +160,9 @@ string CRPCTable::help(string strCommand) const |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
if (strCommand != "" && strMethod != strCommand) |
|
|
|
if (strCommand != "" && strMethod != strCommand) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
if (pcmd->reqWallet && !pwalletMain) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
Array params; |
|
|
|
Array params; |
|
|
@ -218,77 +221,77 @@ Value stop(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const CRPCCommand vRPCCommands[] = |
|
|
|
static const CRPCCommand vRPCCommands[] = |
|
|
|
{ // name actor (function) okSafeMode threadSafe
|
|
|
|
{ // name actor (function) okSafeMode threadSafe reqWallet
|
|
|
|
// ------------------------ ----------------------- ---------- ----------
|
|
|
|
// ------------------------ ----------------------- ---------- ---------- ---------
|
|
|
|
{ "help", &help, true, true }, |
|
|
|
{ "help", &help, true, true, false }, |
|
|
|
{ "stop", &stop, true, true }, |
|
|
|
{ "stop", &stop, true, true, false }, |
|
|
|
{ "getblockcount", &getblockcount, true, false }, |
|
|
|
{ "getblockcount", &getblockcount, true, false, false }, |
|
|
|
{ "getbestblockhash", &getbestblockhash, true, false }, |
|
|
|
{ "getbestblockhash", &getbestblockhash, true, false, false }, |
|
|
|
{ "getconnectioncount", &getconnectioncount, true, false }, |
|
|
|
{ "getconnectioncount", &getconnectioncount, true, false, false }, |
|
|
|
{ "getpeerinfo", &getpeerinfo, true, false }, |
|
|
|
{ "getpeerinfo", &getpeerinfo, true, false, false }, |
|
|
|
{ "addnode", &addnode, true, true }, |
|
|
|
{ "addnode", &addnode, true, true, false }, |
|
|
|
{ "getaddednodeinfo", &getaddednodeinfo, true, true }, |
|
|
|
{ "getaddednodeinfo", &getaddednodeinfo, true, true, false }, |
|
|
|
{ "getdifficulty", &getdifficulty, true, false }, |
|
|
|
{ "getdifficulty", &getdifficulty, true, false, false }, |
|
|
|
{ "getnetworkhashps", &getnetworkhashps, true, false }, |
|
|
|
{ "getnetworkhashps", &getnetworkhashps, true, false, false }, |
|
|
|
{ "getgenerate", &getgenerate, true, false }, |
|
|
|
{ "getgenerate", &getgenerate, true, false, false }, |
|
|
|
{ "setgenerate", &setgenerate, true, false }, |
|
|
|
{ "setgenerate", &setgenerate, true, false, true }, |
|
|
|
{ "gethashespersec", &gethashespersec, true, false }, |
|
|
|
{ "gethashespersec", &gethashespersec, true, false, false }, |
|
|
|
{ "getinfo", &getinfo, true, false }, |
|
|
|
{ "getinfo", &getinfo, true, false, false }, |
|
|
|
{ "getmininginfo", &getmininginfo, true, false }, |
|
|
|
{ "getmininginfo", &getmininginfo, true, false, false }, |
|
|
|
{ "getnewaddress", &getnewaddress, true, false }, |
|
|
|
{ "getnewaddress", &getnewaddress, true, false, true }, |
|
|
|
{ "getaccountaddress", &getaccountaddress, true, false }, |
|
|
|
{ "getaccountaddress", &getaccountaddress, true, false, true }, |
|
|
|
{ "getrawchangeaddress", &getrawchangeaddress, true, false }, |
|
|
|
{ "getrawchangeaddress", &getrawchangeaddress, true, false, true }, |
|
|
|
{ "setaccount", &setaccount, true, false }, |
|
|
|
{ "setaccount", &setaccount, true, false, true }, |
|
|
|
{ "getaccount", &getaccount, false, false }, |
|
|
|
{ "getaccount", &getaccount, false, false, true }, |
|
|
|
{ "getaddressesbyaccount", &getaddressesbyaccount, true, false }, |
|
|
|
{ "getaddressesbyaccount", &getaddressesbyaccount, true, false, true }, |
|
|
|
{ "sendtoaddress", &sendtoaddress, false, false }, |
|
|
|
{ "sendtoaddress", &sendtoaddress, false, false, true }, |
|
|
|
{ "getreceivedbyaddress", &getreceivedbyaddress, false, false }, |
|
|
|
{ "getreceivedbyaddress", &getreceivedbyaddress, false, false, true }, |
|
|
|
{ "getreceivedbyaccount", &getreceivedbyaccount, false, false }, |
|
|
|
{ "getreceivedbyaccount", &getreceivedbyaccount, false, false, true }, |
|
|
|
{ "listreceivedbyaddress", &listreceivedbyaddress, false, false }, |
|
|
|
{ "listreceivedbyaddress", &listreceivedbyaddress, false, false, true }, |
|
|
|
{ "listreceivedbyaccount", &listreceivedbyaccount, false, false }, |
|
|
|
{ "listreceivedbyaccount", &listreceivedbyaccount, false, false, true }, |
|
|
|
{ "backupwallet", &backupwallet, true, false }, |
|
|
|
{ "backupwallet", &backupwallet, true, false, true }, |
|
|
|
{ "keypoolrefill", &keypoolrefill, true, false }, |
|
|
|
{ "keypoolrefill", &keypoolrefill, true, false, true }, |
|
|
|
{ "walletpassphrase", &walletpassphrase, true, false }, |
|
|
|
{ "walletpassphrase", &walletpassphrase, true, false, true }, |
|
|
|
{ "walletpassphrasechange", &walletpassphrasechange, false, false }, |
|
|
|
{ "walletpassphrasechange", &walletpassphrasechange, false, false, true }, |
|
|
|
{ "walletlock", &walletlock, true, false }, |
|
|
|
{ "walletlock", &walletlock, true, false, true }, |
|
|
|
{ "encryptwallet", &encryptwallet, false, false }, |
|
|
|
{ "encryptwallet", &encryptwallet, false, false, true }, |
|
|
|
{ "validateaddress", &validateaddress, true, false }, |
|
|
|
{ "validateaddress", &validateaddress, true, false, false }, |
|
|
|
{ "getbalance", &getbalance, false, false }, |
|
|
|
{ "getbalance", &getbalance, false, false, true }, |
|
|
|
{ "move", &movecmd, false, false }, |
|
|
|
{ "move", &movecmd, false, false, true }, |
|
|
|
{ "sendfrom", &sendfrom, false, false }, |
|
|
|
{ "sendfrom", &sendfrom, false, false, true }, |
|
|
|
{ "sendmany", &sendmany, false, false }, |
|
|
|
{ "sendmany", &sendmany, false, false, true }, |
|
|
|
{ "addmultisigaddress", &addmultisigaddress, false, false }, |
|
|
|
{ "addmultisigaddress", &addmultisigaddress, false, false, true }, |
|
|
|
{ "createmultisig", &createmultisig, true, true }, |
|
|
|
{ "createmultisig", &createmultisig, true, true , false }, |
|
|
|
{ "getrawmempool", &getrawmempool, true, false }, |
|
|
|
{ "getrawmempool", &getrawmempool, true, false, false }, |
|
|
|
{ "getblock", &getblock, false, false }, |
|
|
|
{ "getblock", &getblock, false, false, false }, |
|
|
|
{ "getblockhash", &getblockhash, false, false }, |
|
|
|
{ "getblockhash", &getblockhash, false, false, false }, |
|
|
|
{ "gettransaction", &gettransaction, false, false }, |
|
|
|
{ "gettransaction", &gettransaction, false, false, true }, |
|
|
|
{ "listtransactions", &listtransactions, false, false }, |
|
|
|
{ "listtransactions", &listtransactions, false, false, true }, |
|
|
|
{ "listaddressgroupings", &listaddressgroupings, false, false }, |
|
|
|
{ "listaddressgroupings", &listaddressgroupings, false, false, true }, |
|
|
|
{ "signmessage", &signmessage, false, false }, |
|
|
|
{ "signmessage", &signmessage, false, false, true }, |
|
|
|
{ "verifymessage", &verifymessage, false, false }, |
|
|
|
{ "verifymessage", &verifymessage, false, false, false }, |
|
|
|
{ "getwork", &getwork, true, false }, |
|
|
|
{ "getwork", &getwork, true, false, true }, |
|
|
|
{ "listaccounts", &listaccounts, false, false }, |
|
|
|
{ "listaccounts", &listaccounts, false, false, true }, |
|
|
|
{ "settxfee", &settxfee, false, false }, |
|
|
|
{ "settxfee", &settxfee, false, false, true }, |
|
|
|
{ "getblocktemplate", &getblocktemplate, true, false }, |
|
|
|
{ "getblocktemplate", &getblocktemplate, true, false, false }, |
|
|
|
{ "submitblock", &submitblock, false, false }, |
|
|
|
{ "submitblock", &submitblock, false, false, false }, |
|
|
|
{ "listsinceblock", &listsinceblock, false, false }, |
|
|
|
{ "listsinceblock", &listsinceblock, false, false, true }, |
|
|
|
{ "dumpprivkey", &dumpprivkey, true, false }, |
|
|
|
{ "dumpprivkey", &dumpprivkey, true, false, true }, |
|
|
|
{ "dumpwallet", &dumpwallet, true, false }, |
|
|
|
{ "dumpwallet", &dumpwallet, true, false, true }, |
|
|
|
{ "importprivkey", &importprivkey, false, false }, |
|
|
|
{ "importprivkey", &importprivkey, false, false, true }, |
|
|
|
{ "importwallet", &importwallet, false, false }, |
|
|
|
{ "importwallet", &importwallet, false, false, true }, |
|
|
|
{ "listunspent", &listunspent, false, false }, |
|
|
|
{ "listunspent", &listunspent, false, false, true }, |
|
|
|
{ "getrawtransaction", &getrawtransaction, false, false }, |
|
|
|
{ "getrawtransaction", &getrawtransaction, false, false, false }, |
|
|
|
{ "createrawtransaction", &createrawtransaction, false, false }, |
|
|
|
{ "createrawtransaction", &createrawtransaction, false, false, false }, |
|
|
|
{ "decoderawtransaction", &decoderawtransaction, false, false }, |
|
|
|
{ "decoderawtransaction", &decoderawtransaction, false, false, false }, |
|
|
|
{ "decodescript", &decodescript, false, false }, |
|
|
|
{ "decodescript", &decodescript, false, false, false }, |
|
|
|
{ "signrawtransaction", &signrawtransaction, false, false }, |
|
|
|
{ "signrawtransaction", &signrawtransaction, false, false, false }, |
|
|
|
{ "sendrawtransaction", &sendrawtransaction, false, false }, |
|
|
|
{ "sendrawtransaction", &sendrawtransaction, false, false, false }, |
|
|
|
{ "gettxoutsetinfo", &gettxoutsetinfo, true, false }, |
|
|
|
{ "gettxoutsetinfo", &gettxoutsetinfo, true, false, false }, |
|
|
|
{ "gettxout", &gettxout, true, false }, |
|
|
|
{ "gettxout", &gettxout, true, false, false }, |
|
|
|
{ "lockunspent", &lockunspent, false, false }, |
|
|
|
{ "lockunspent", &lockunspent, false, false, true }, |
|
|
|
{ "listlockunspent", &listlockunspent, false, false }, |
|
|
|
{ "listlockunspent", &listlockunspent, false, false, true }, |
|
|
|
{ "verifychain", &verifychain, true, false }, |
|
|
|
{ "verifychain", &verifychain, true, false, false }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
CRPCTable::CRPCTable() |
|
|
|
CRPCTable::CRPCTable() |
|
|
@ -1065,6 +1068,8 @@ json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_s |
|
|
|
const CRPCCommand *pcmd = tableRPC[strMethod]; |
|
|
|
const CRPCCommand *pcmd = tableRPC[strMethod]; |
|
|
|
if (!pcmd) |
|
|
|
if (!pcmd) |
|
|
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
|
|
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
|
|
|
|
|
|
|
if (pcmd->reqWallet && !pwalletMain) |
|
|
|
|
|
|
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)"); |
|
|
|
|
|
|
|
|
|
|
|
// Observe safe mode
|
|
|
|
// Observe safe mode
|
|
|
|
string strWarning = GetWarnings("rpc"); |
|
|
|
string strWarning = GetWarnings("rpc"); |
|
|
@ -1079,7 +1084,10 @@ json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_s |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (pcmd->threadSafe) |
|
|
|
if (pcmd->threadSafe) |
|
|
|
result = pcmd->actor(params, false); |
|
|
|
result = pcmd->actor(params, false); |
|
|
|
else { |
|
|
|
else if (!pwalletMain) { |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
|
|
|
|
result = pcmd->actor(params, false); |
|
|
|
|
|
|
|
} else { |
|
|
|
LOCK2(cs_main, pwalletMain->cs_wallet); |
|
|
|
LOCK2(cs_main, pwalletMain->cs_wallet); |
|
|
|
result = pcmd->actor(params, false); |
|
|
|
result = pcmd->actor(params, false); |
|
|
|
} |
|
|
|
} |
|
|
|