MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / RPCTypeCheckObj

Function RPCTypeCheckObj

src/rpcserver.cpp:90–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void 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
109CAmount AmountFromValue(const UniValue& value)
110{

Callers 2

signrawtransactionFunction · 0.85
lockunspentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected