Merge pull request #5711
5ebe095Trim RPC command table (Wladimir J. van der Laan)4401b2dRemoved main.h dependency from rpcserver.cpp (Eric Lombrozo)
This commit is contained in:
@@ -90,6 +90,8 @@ Value getnewaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getnewaddress", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Parse the account first so we don't generate a key if there's an error
|
||||
string strAccount;
|
||||
if (params.size() > 0)
|
||||
@@ -164,13 +166,14 @@ Value getaccountaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getaccountaddress", "\"myaccount\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Parse the account first so we don't generate a key if there's an error
|
||||
string strAccount = AccountFromValue(params[0]);
|
||||
|
||||
Value ret;
|
||||
|
||||
ret = GetAccountAddress(strAccount).ToString();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -189,6 +192,8 @@ Value getrawchangeaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getrawchangeaddress", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (!pwalletMain->IsLocked())
|
||||
pwalletMain->TopUpKeyPool();
|
||||
|
||||
@@ -219,11 +224,12 @@ Value setaccount(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("setaccount", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"tabby\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
CBitcoinAddress address(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
|
||||
|
||||
string strAccount;
|
||||
if (params.size() > 1)
|
||||
strAccount = AccountFromValue(params[1]);
|
||||
@@ -262,6 +268,8 @@ Value getaccount(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getaccount", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
CBitcoinAddress address(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
@@ -292,6 +300,8 @@ Value getaddressesbyaccount(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getaddressesbyaccount", "\"tabby\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount = AccountFromValue(params[0]);
|
||||
|
||||
// Find all addresses that have the given account
|
||||
@@ -363,6 +373,8 @@ Value sendtoaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
CBitcoinAddress address(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
@@ -409,6 +421,8 @@ Value listaddressgroupings(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listaddressgroupings", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
Array jsonGroupings;
|
||||
map<CTxDestination, CAmount> balances = pwalletMain->GetAddressBalances();
|
||||
BOOST_FOREACH(set<CTxDestination> grouping, pwalletMain->GetAddressGroupings())
|
||||
@@ -454,6 +468,8 @@ Value signmessage(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("signmessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"my message\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
EnsureWalletIsUnlocked();
|
||||
|
||||
string strAddress = params[0].get_str();
|
||||
@@ -504,6 +520,8 @@ Value getreceivedbyaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getreceivedbyaddress", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Bitcoin address
|
||||
CBitcoinAddress address = CBitcoinAddress(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
@@ -557,6 +575,8 @@ Value getreceivedbyaccount(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getreceivedbyaccount", "\"tabby\", 6")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 1)
|
||||
@@ -643,6 +663,8 @@ Value getbalance(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getbalance", "\"*\", 6")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (params.size() == 0)
|
||||
return ValueFromAmount(pwalletMain->GetBalance());
|
||||
|
||||
@@ -695,6 +717,9 @@ Value getunconfirmedbalance(const Array ¶ms, bool fHelp)
|
||||
throw runtime_error(
|
||||
"getunconfirmedbalance\n"
|
||||
"Returns the server's total unconfirmed balance\n");
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
return ValueFromAmount(pwalletMain->GetUnconfirmedBalance());
|
||||
}
|
||||
|
||||
@@ -721,6 +746,8 @@ Value movecmd(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("move", "\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strFrom = AccountFromValue(params[0]);
|
||||
string strTo = AccountFromValue(params[1]);
|
||||
CAmount nAmount = AmountFromValue(params[2]);
|
||||
@@ -793,6 +820,8 @@ Value sendfrom(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("sendfrom", "\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount = AccountFromValue(params[0]);
|
||||
CBitcoinAddress address(params[1].get_str());
|
||||
if (!address.IsValid())
|
||||
@@ -850,6 +879,8 @@ Value sendmany(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("sendmany", "\"\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount = AccountFromValue(params[0]);
|
||||
Object sendTo = params[1].get_obj();
|
||||
int nMinDepth = 1;
|
||||
@@ -935,6 +966,8 @@ Value addmultisigaddress(const Array& params, bool fHelp)
|
||||
throw runtime_error(msg);
|
||||
}
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount;
|
||||
if (params.size() > 2)
|
||||
strAccount = AccountFromValue(params[2]);
|
||||
@@ -1110,6 +1143,8 @@ Value listreceivedbyaddress(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listreceivedbyaddress", "6, true, true")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
return ListReceived(params, false);
|
||||
}
|
||||
|
||||
@@ -1141,6 +1176,8 @@ Value listreceivedbyaccount(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listreceivedbyaccount", "6, true, true")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
return ListReceived(params, true);
|
||||
}
|
||||
|
||||
@@ -1292,6 +1329,8 @@ Value listtransactions(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listtransactions", "\"*\", 20, 100")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount = "*";
|
||||
if (params.size() > 0)
|
||||
strAccount = params[0].get_str();
|
||||
@@ -1372,6 +1411,8 @@ Value listaccounts(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listaccounts", "6")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 0)
|
||||
nMinDepth = params[0].get_int();
|
||||
@@ -1460,6 +1501,8 @@ Value listsinceblock(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
CBlockIndex *pindex = NULL;
|
||||
int target_confirms = 1;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
@@ -1546,6 +1589,8 @@ Value gettransaction(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
uint256 hash;
|
||||
hash.SetHex(params[0].get_str());
|
||||
|
||||
@@ -1594,6 +1639,8 @@ Value backupwallet(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("backupwallet", "\"backup.dat\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strDest = params[0].get_str();
|
||||
if (!BackupWallet(*pwalletMain, strDest))
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!");
|
||||
@@ -1616,6 +1663,8 @@ Value keypoolrefill(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("keypoolrefill", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
|
||||
unsigned int kpSize = 0;
|
||||
if (params.size() > 0) {
|
||||
@@ -1663,6 +1712,8 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (fHelp)
|
||||
return true;
|
||||
if (!pwalletMain->IsCrypted())
|
||||
@@ -1710,6 +1761,8 @@ Value walletpassphrasechange(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (fHelp)
|
||||
return true;
|
||||
if (!pwalletMain->IsCrypted())
|
||||
@@ -1756,6 +1809,8 @@ Value walletlock(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("walletlock", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (fHelp)
|
||||
return true;
|
||||
if (!pwalletMain->IsCrypted())
|
||||
@@ -1797,6 +1852,8 @@ Value encryptwallet(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("encryptwallet", "\"my pass phrase\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (fHelp)
|
||||
return true;
|
||||
if (pwalletMain->IsCrypted())
|
||||
@@ -1861,6 +1918,8 @@ Value lockunspent(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("lockunspent", "false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
if (params.size() == 1)
|
||||
RPCTypeCheck(params, boost::assign::list_of(bool_type));
|
||||
else
|
||||
@@ -1930,6 +1989,8 @@ Value listlockunspent(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("listlockunspent", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
vector<COutPoint> vOutpts;
|
||||
pwalletMain->ListLockedCoins(vOutpts);
|
||||
|
||||
@@ -1961,6 +2022,8 @@ Value settxfee(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("settxfee", "0.00001")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Amount
|
||||
CAmount nAmount = 0;
|
||||
if (params[0].get_real() != 0.0)
|
||||
@@ -1992,6 +2055,8 @@ Value getwalletinfo(const Array& params, bool fHelp)
|
||||
+ HelpExampleRpc("getwalletinfo", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
Object obj;
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
|
||||
Reference in New Issue
Block a user