Revert "Deprecate accounting API."
authorCryptoManiac <balthazar@yandex.ru>
Sat, 28 Mar 2015 20:02:41 +0000 (23:02 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Sat, 28 Mar 2015 20:02:41 +0000 (23:02 +0300)
https://bitcointalk.org/index.php?topic=704756.msg10914532#msg10914532

This reverts commit ea4a5e1318276e5b148f2122e0057675c801129f.

src/rpcwallet.cpp

index c55296c..5607a4b 100644 (file)
@@ -24,15 +24,6 @@ std::string HelpRequiringPassphrase()
         : "";
 }
 
-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())
@@ -182,9 +173,6 @@ Value getaccountaddress(const Array& params, bool fHelp)
             "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]);
 
@@ -508,9 +496,6 @@ Value getreceivedbyaccount(const Array& params, bool fHelp)
             "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)
@@ -625,9 +610,6 @@ Value getbalance(const Array& params, bool fHelp)
         return  ValueFromAmount(nBalance);
     }
 
-    // Deprecation check
-    accountingAllowed();
-
     string strAccount = AccountFromValue(params[0]);
 
     int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, filter);
@@ -643,9 +625,6 @@ Value movecmd(const Array& params, bool fHelp)
             "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]);
@@ -701,9 +680,6 @@ Value sendfrom(const Array& params, bool fHelp)
             "<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())
@@ -748,9 +724,6 @@ Value sendmany(const Array& params, bool fHelp)
             "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;
@@ -790,13 +763,10 @@ Value sendmany(const Array& params, bool fHelp)
 
     EnsureWalletIsUnlocked();
 
-    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");
-    }
+    // 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);
@@ -1044,9 +1014,6 @@ Value listreceivedbyaccount(const Array& params, bool fHelp)
             "  \"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);
 }
 
@@ -1236,9 +1203,6 @@ Value listaccounts(const Array& params, bool fHelp)
             "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();