]> Git Repo - VerusCoin.git/commitdiff
Build fix for wallet_utility
authormiketout <[email protected]>
Tue, 5 May 2020 02:59:34 +0000 (19:59 -0700)
committermiketout <[email protected]>
Tue, 5 May 2020 02:59:34 +0000 (19:59 -0700)
src/core_write.cpp
src/script/script.cpp

index d3bf884e39294bb65d0532b8540f47d4c64a112d..a92f3fa2cd9c34266d385b302dd2121d3417ac96 100644 (file)
@@ -178,14 +178,49 @@ UniValue CNodeData::ToUniValue() const
     return obj;
 }
 
+CCurrencyValueMap::CCurrencyValueMap(const UniValue &uni)
+{
+    // must be an array of key:value, where key is currency ID encoded as i-address
+    if (uni.isObject())
+    {
+        const std::vector<std::string> &keys(uni.getKeys());
+        const std::vector<UniValue> &values(uni.getValues());
+        for (int i = 0; i < keys.size(); i++)
+        {
+            uint160 currencyID = GetDestinationID(DecodeDestination(keys[i]));
+            if (currencyID.IsNull())
+            {
+                LogPrintf("Invalid JSON CurrencyValueMap\n");
+                valueMap.clear();
+                break;
+            }
+            if (valueMap.count(currencyID))
+            {
+                LogPrintf("Duplicate currency in JSON CurrencyValueMap\n");
+                valueMap.clear();
+                break;
+            }
+
+            try
+            {
+                valueMap[currencyID] = AmountFromValueNoErr(values[i]);
+            }
+            catch(const std::exception& e)
+            {
+                std::cerr << e.what() << '\n';
+                valueMap.clear();
+                break;
+            }
+        }
+    }
+}
+
 UniValue CCurrencyValueMap::ToUniValue() const
 {
-    UniValue retVal(UniValue::VARR);
+    UniValue retVal(UniValue::VOBJ);
     for (auto &curValue : valueMap)
     {
-        UniValue obj(UniValue::VOBJ);
-        obj.push_back(Pair(EncodeDestination(CIdentityID(curValue.first)), ValueFromAmount(curValue.second)));
-        retVal.push_back(obj);
+        retVal.push_back(Pair(EncodeDestination(CIdentityID(curValue.first)), ValueFromAmount(curValue.second)));
     }
     return retVal;
 }
index d895017fa971c0ba557595642ad5e9cd23034a46..a16ae41dc4dd2ca2d4d2ccfc2efeb09fca9ca425 100644 (file)
@@ -1061,43 +1061,6 @@ CAmount AmountFromValueNoErr(const UniValue& value)
     }
 }
 
-CCurrencyValueMap::CCurrencyValueMap(const UniValue &uni)
-{
-    // must be an array of key:value, where key is currency ID encoded as i-address
-    if (uni.isArray())
-    {
-        const std::vector<std::string> &keys = uni.getKeys();
-        const std::vector<UniValue> &values = uni.getValues();
-        for (int i = 0; i < keys.size(); i++)
-        {
-            uint160 currencyID = GetDestinationID(DecodeDestination(keys[i]));
-            if (currencyID.IsNull())
-            {
-                LogPrintf("Invalid JSON CurrencyValueMap\n");
-                valueMap.clear();
-                break;
-            }
-            if (valueMap.count(currencyID))
-            {
-                LogPrintf("Duplicate currency in JSON CurrencyValueMap\n");
-                valueMap.clear();
-                break;
-            }
-
-            try
-            {
-                valueMap[currencyID] = AmountFromValueNoErr(values[i]);
-            }
-            catch(const std::exception& e)
-            {
-                std::cerr << e.what() << '\n';
-                valueMap.clear();
-                break;
-            }
-        }
-    }
-}
-
 CCurrencyValueMap::CCurrencyValueMap(const std::vector<uint160> &currencyIDs, const std::vector<CAmount> &amounts)
 {
     int commonNum = currencyIDs.size() >= amounts.size() ? amounts.size() : currencyIDs.size();
This page took 0.031425 seconds and 4 git commands to generate.