: "";
}
+static void accountingAllowed()
+{
+ if (!GetBoolArg("-accounts", false))
+ throw runtime_error(
+ "Accounting API is deprecated and its removal is planned in the future.\n"
+ "It can easily result in negative or odd balances if misused or misunderstood.\n"
+ "If you still want to enable it then add accounts=1 to your options.\n");
+}
+
void EnsureWalletIsUnlocked()
{
if (pwalletMain->IsLocked())
"getaccountaddress <account>\n"
"Returns the current NovaCoin address for receiving payments to this account.");
+ // Deprecation check
+ accountingAllowed();
+
// Parse the account first so we don't generate a key if there's an error
string strAccount = AccountFromValue(params[0]);
"getreceivedbyaccount <account> [minconf=1]\n"
"Returns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.");
+ // Deprecation check
+ accountingAllowed();
+
// Minimum confirmations
int nMinDepth = 1;
if (params.size() > 1)
return ValueFromAmount(nBalance);
}
+ // Deprecation check
+ accountingAllowed();
+
string strAccount = AccountFromValue(params[0]);
int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, filter);
"move <fromaccount> <toaccount> <amount> [minconf=1] [comment]\n"
"Move from one account in your wallet to another.");
+ // Deprecation check
+ accountingAllowed();
+
string strFrom = AccountFromValue(params[0]);
string strTo = AccountFromValue(params[1]);
int64_t nAmount = AmountFromValue(params[2]);
"<amount> is a real and is rounded to the nearest " + FormatMoney(MIN_TXOUT_AMOUNT)
+ HelpRequiringPassphrase());
+ // Deprecation check
+ accountingAllowed();
+
string strAccount = AccountFromValue(params[0]);
CBitcoinAddress address(params[1].get_str());
if (!address.IsValid())
"amounts are double-precision floating point numbers"
+ HelpRequiringPassphrase());
+ // Deprecation check
+ accountingAllowed();
+
string strAccount = AccountFromValue(params[0]);
Object sendTo = params[1].get_obj();
int nMinDepth = 1;
EnsureWalletIsUnlocked();
- // Check funds
- int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, MINE_SPENDABLE);
- if (totalAmount > nBalance)
- throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
+ if (GetBoolArg("-accounts", false))
+ {
+ // Check funds
+ int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, MINE_SPENDABLE);
+ if (totalAmount > nBalance)
+ throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
+ }
// Send
CReserveKey keyChange(pwalletMain);
" \"amount\" : total amount received by addresses with this account\n"
" \"confirmations\" : number of confirmations of the most recent transaction included");
+ // Deprecation check
+ accountingAllowed();
+
return ListReceived(params, true);
}
"listaccounts [minconf=1]\n"
"Returns Object that has account names as keys, account balances as values.");
+ // Deprecation check
+ accountingAllowed();
+
int nMinDepth = 1;
if (params.size() > 0)
nMinDepth = params[0].get_int();