RPC: modify mergecoins
[novacoin.git] / src / rpcwallet.cpp
index ed024a5..5da0a3b 100644 (file)
@@ -259,40 +259,39 @@ Value mergecoins(const Array& params, bool fHelp)
 {
     if (fHelp || params.size() != 3)
         throw runtime_error(
-            "mergecoins <amount> <outputvalue> <maxvalue>\n"
+            "mergecoins <amount> <minvalue> <outputvalue>\n"
             "<amount> is resulting inputs sum\n"
+            "<minvalue> is minimum value of inputs which are used in join process\n"
             "<outputvalue> is resulting value of inputs which will be created\n"
-            "<maxvalue> is maximum value of inputs which are used in join process\n"
             "All values are real and and rounded to the nearest " + FormatMoney(MIN_TXOUT_AMOUNT)
             + HelpRequiringPassphrase());
 
     if (pwalletMain->IsLocked())
         throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
 
-    // Amount
+    // Total amount
     int64 nAmount = AmountFromValue(params[0]);
 
-    // Amount
-    int64 nOutputValue = AmountFromValue(params[1]);
+    // Min input amount
+    int64 nMinValue = AmountFromValue(params[1]);
 
-    // Amount
-    int64 nMaxValue = AmountFromValue(params[2]);
+    // Output amount
+    int64 nOutputValue = AmountFromValue(params[2]);
 
     if (nAmount < MIN_TXOUT_AMOUNT)
         throw JSONRPCError(-101, "Send amount too small");
 
-    if (nOutputValue < MIN_TXOUT_AMOUNT)
-        throw JSONRPCError(-101, "Output value too small");
-
-    if (nMaxValue < MIN_TXOUT_AMOUNT)
+    if (nMinValue < MIN_TXOUT_AMOUNT)
         throw JSONRPCError(-101, "Max value too small");
 
-    if (nOutputValue < nMaxValue)
-        throw JSONRPCError(-101, "Output value is lower than max value");
+    if (nOutputValue < MIN_TXOUT_AMOUNT)
+        throw JSONRPCError(-101, "Output value too small");
 
+    if (nOutputValue < nMinValue)
+        throw JSONRPCError(-101, "Output value is lower than min value");
 
     list<uint256> listMerged;
-    if (!pwalletMain->MergeCoins(nAmount, nMaxValue, nOutputValue, listMerged))
+    if (!pwalletMain->MergeCoins(nAmount, nMinValue, nOutputValue, listMerged))
         return Value::null;
 
     Array mergedHashes;