diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2017-06-06 21:15:28 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2017-06-06 21:29:16 +0200 |
commit | 3fb81a8480582d96e8c87ef1b963a11c55064d57 (patch) | |
tree | 281172cf926a2384dbada8832f6e55fe995b8631 /src/rpc | |
parent | 1b708f2cf3e6e6a17c5b6dbf2909a2ed2e35755a (diff) |
Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/mining.cpp | 8 | ||||
-rw-r--r-- | src/rpc/misc.cpp | 4 | ||||
-rw-r--r-- | src/rpc/rawtransaction.cpp | 29 |
3 files changed, 17 insertions, 24 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index cfe42ec7d8..d8c4702346 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -27,8 +27,6 @@ #include <memory> #include <stdint.h> -#include <boost/assign/list_of.hpp> - #include <univalue.h> /** @@ -819,7 +817,7 @@ UniValue estimatefee(const JSONRPCRequest& request) + HelpExampleCli("estimatefee", "6") ); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)); + RPCTypeCheck(request.params, {UniValue::VNUM}); int nBlocks = request.params[0].get_int(); if (nBlocks < 1) @@ -860,7 +858,7 @@ UniValue estimatesmartfee(const JSONRPCRequest& request) + HelpExampleCli("estimatesmartfee", "6") ); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)); + RPCTypeCheck(request.params, {UniValue::VNUM}); int nBlocks = request.params[0].get_int(); bool conservative = true; @@ -917,7 +915,7 @@ UniValue estimaterawfee(const JSONRPCRequest& request) + HelpExampleCli("estimaterawfee", "6 0.9 1") ); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)(UniValue::VNUM)(UniValue::VNUM), true); + RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM, UniValue::VNUM}, true); RPCTypeCheckArgument(request.params[0], UniValue::VNUM); int nBlocks = request.params[0].get_int(); double threshold = 0.95; diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 1f973a0c18..f6f01eef4b 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -27,8 +27,6 @@ #include <malloc.h> #endif -#include <boost/assign/list_of.hpp> - #include <univalue.h> /** @@ -472,7 +470,7 @@ UniValue setmocktime(const JSONRPCRequest& request) // ensure all call sites of GetTime() are accessing this safely. LOCK(cs_main); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)); + RPCTypeCheck(request.params, {UniValue::VNUM}); SetMockTime(request.params[0].get_int64()); return NullUniValue; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index e27c2a77c7..0fc5e89809 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -30,8 +30,6 @@ #include <stdint.h> -#include <boost/assign/list_of.hpp> - #include <univalue.h> @@ -325,7 +323,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request) + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"") ); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)(UniValue::VNUM), true); + RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VOBJ, UniValue::VNUM}, true); if (request.params[0].isNull() || request.params[1].isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null"); @@ -456,7 +454,7 @@ UniValue decoderawtransaction(const JSONRPCRequest& request) ); LOCK(cs_main); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)); + RPCTypeCheck(request.params, {UniValue::VSTR}); CMutableTransaction mtx; @@ -494,7 +492,7 @@ UniValue decodescript(const JSONRPCRequest& request) + HelpExampleRpc("decodescript", "\"hexstring\"") ); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)); + RPCTypeCheck(request.params, {UniValue::VSTR}); UniValue r(UniValue::VOBJ); CScript script; @@ -605,7 +603,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) #else LOCK(cs_main); #endif - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VARR)(UniValue::VARR)(UniValue::VSTR), true); + RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true); std::vector<unsigned char> txData(ParseHexV(request.params[0], "argument 1")); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); @@ -740,15 +738,14 @@ UniValue signrawtransaction(const JSONRPCRequest& request) int nHashType = SIGHASH_ALL; if (request.params.size() > 3 && !request.params[3].isNull()) { - static std::map<std::string, int> mapSigHashValues = - boost::assign::map_list_of - (std::string("ALL"), int(SIGHASH_ALL)) - (std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)) - (std::string("NONE"), int(SIGHASH_NONE)) - (std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)) - (std::string("SINGLE"), int(SIGHASH_SINGLE)) - (std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)) - ; + static std::map<std::string, int> mapSigHashValues = { + {std::string("ALL"), int(SIGHASH_ALL)}, + {std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)}, + {std::string("NONE"), int(SIGHASH_NONE)}, + {std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)}, + {std::string("SINGLE"), int(SIGHASH_SINGLE)}, + {std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)}, + }; std::string strHashType = request.params[3].get_str(); if (mapSigHashValues.count(strHashType)) nHashType = mapSigHashValues[strHashType]; @@ -830,7 +827,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request) ); LOCK(cs_main); - RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VBOOL)); + RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}); // parse hex string from parameter CMutableTransaction mtx; |