diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-01-17 10:40:41 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2017-01-19 11:29:29 -0500 |
commit | 52dde66770d833ee5e42e7c5fee610453ae3852a (patch) | |
tree | 1cb223500d2737ffe81a3578df430e27ffaca8e7 /src/rpc/server.cpp | |
parent | 766e8a40b478353a89622f42809ddb11e695a0c9 (diff) |
[wallet] Add include_unsafe argument to listunspent RPC
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r-- | src/rpc/server.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 1b94e10071..283d458c8d 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -79,16 +79,20 @@ void RPCTypeCheck(const UniValue& params, break; const UniValue& v = params[i]; - if (!((v.type() == t) || (fAllowNull && (v.isNull())))) - { - string err = strprintf("Expected type %s, got %s", - uvTypeName(t), uvTypeName(v.type())); - throw JSONRPCError(RPC_TYPE_ERROR, err); + if (!(fAllowNull && v.isNull())) { + RPCTypeCheckArgument(v, t); } i++; } } +void RPCTypeCheckArgument(const UniValue& value, UniValue::VType typeExpected) +{ + if (value.type() != typeExpected) { + throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Expected type %s, got %s", uvTypeName(typeExpected), uvTypeName(value.type()))); + } +} + void RPCTypeCheckObj(const UniValue& o, const map<string, UniValueType>& typesExpected, bool fAllowNull, |