diff options
author | MarcoFalke <falke.marco@gmail.com> | 2016-06-06 17:50:50 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2016-06-07 13:12:57 +0200 |
commit | fa7f4f577cbab2b4bc03b5427704c2ec16680c34 (patch) | |
tree | 9ceac88ffe807278f80ca8d3afb3aa4a6de14207 /src/rpc/server.cpp | |
parent | faf82e8fc819b2f1f8b60983ac72cb111c47e8ba (diff) |
[rpc] fundrawtransaction feeRate: Use BTC/kB
Also introduce UniValueType
UniValueType is a wrapper for UniValue::VType which allows setting
a typeAny flag. This flag indicates the type does not matter.
(Used by RPCTypeCheckObj)
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r-- | src/rpc/server.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index d06a9142b6..23149baa6d 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -88,20 +88,18 @@ void RPCTypeCheck(const UniValue& params, } void RPCTypeCheckObj(const UniValue& o, - const map<string, UniValue::VType>& typesExpected, - bool fAllowNull, - bool fStrict) + const map<string, UniValueType>& typesExpected, + bool fAllowNull, + bool fStrict) { - BOOST_FOREACH(const PAIRTYPE(string, UniValue::VType)& t, typesExpected) - { + for (const auto& t : typesExpected) { const UniValue& v = find_value(o, t.first); if (!fAllowNull && v.isNull()) throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first)); - if (!((v.type() == t.second) || (fAllowNull && (v.isNull())))) - { + if (!(t.second.typeAny || v.type() == t.second.type || (fAllowNull && v.isNull()))) { string err = strprintf("Expected type %s for %s, got %s", - uvTypeName(t.second), t.first, uvTypeName(v.type())); + uvTypeName(t.second.type), t.first, uvTypeName(v.type())); throw JSONRPCError(RPC_TYPE_ERROR, err); } } |