| 88 | } |
| 89 | |
| 90 | void RPCTypeCheckObj(const UniValue& o, |
| 91 | const map<string, UniValue::VType>& typesExpected, |
| 92 | bool fAllowNull) |
| 93 | { |
| 94 | BOOST_FOREACH(const PAIRTYPE(string, UniValue::VType)& t, typesExpected) |
| 95 | { |
| 96 | const UniValue& v = find_value(o, t.first); |
| 97 | if (!fAllowNull && v.isNull()) |
| 98 | throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first)); |
| 99 | |
| 100 | if (!((v.type() == t.second) || (fAllowNull && (v.isNull())))) |
| 101 | { |
| 102 | string err = strprintf("Expected type %s for %s, got %s", |
| 103 | uvTypeName(t.second), t.first, uvTypeName(v.type())); |
| 104 | throw JSONRPCError(RPC_TYPE_ERROR, err); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | CAmount AmountFromValue(const UniValue& value) |
| 110 | { |
no outgoing calls
no test coverage detected