|
|
|
@ -89,7 +89,8 @@ void RPCTypeCheck(const UniValue& params,
@@ -89,7 +89,8 @@ void RPCTypeCheck(const UniValue& params,
|
|
|
|
|
|
|
|
|
|
void RPCTypeCheckObj(const UniValue& o, |
|
|
|
|
const map<string, UniValue::VType>& typesExpected, |
|
|
|
|
bool fAllowNull) |
|
|
|
|
bool fAllowNull, |
|
|
|
|
bool fStrict) |
|
|
|
|
{ |
|
|
|
|
BOOST_FOREACH(const PAIRTYPE(string, UniValue::VType)& t, typesExpected) |
|
|
|
|
{ |
|
|
|
@ -104,6 +105,18 @@ void RPCTypeCheckObj(const UniValue& o,
@@ -104,6 +105,18 @@ void RPCTypeCheckObj(const UniValue& o,
|
|
|
|
|
throw JSONRPCError(RPC_TYPE_ERROR, err); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (fStrict) |
|
|
|
|
{ |
|
|
|
|
BOOST_FOREACH(const string& k, o.getKeys()) |
|
|
|
|
{ |
|
|
|
|
if (typesExpected.count(k) == 0) |
|
|
|
|
{ |
|
|
|
|
string err = strprintf("Unexpected key %s", k); |
|
|
|
|
throw JSONRPCError(RPC_TYPE_ERROR, err); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CAmount AmountFromValue(const UniValue& value) |
|
|
|
|