From 52dde66770d833ee5e42e7c5fee610453ae3852a Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 17 Jan 2017 10:40:41 -0500 Subject: [wallet] Add include_unsafe argument to listunspent RPC --- src/rpc/server.cpp | 14 +++++++++----- src/rpc/server.h | 5 +++++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 1b94e1007..283d458c8 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& typesExpected, bool fAllowNull, diff --git a/src/rpc/server.h b/src/rpc/server.h index fed3d8c90..52f82866d 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -78,6 +78,11 @@ bool RPCIsInWarmup(std::string *statusOut); void RPCTypeCheck(const UniValue& params, const std::list& typesExpected, bool fAllowNull=false); +/** + * Type-check one argument; throws JSONRPCError if wrong type given. + */ +void RPCTypeCheckArgument(const UniValue& value, UniValue::VType typeExpected); + /* Check for expected keys/value types in an Object. */ -- cgit v1.2.3 From cc0243ad32cee1cc9faab317364b889beaf07647 Mon Sep 17 00:00:00 2001 From: mrbandrews Date: Fri, 9 Dec 2016 13:45:27 -0500 Subject: [RPC] bumpfee This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B. T must signal that it is BIP-125 replaceable. T's change output is decremented to pay the additional fee. (B will not add inputs to T.) T cannot have any descendant transactions. Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined. Includes code by @jonasschnelli and @ryanofsky --- src/rpc/client.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rpc') diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 422d005f0..28d24b84f 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -116,6 +116,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "setnetworkactive", 0, "state" }, { "getmempoolancestors", 1, "verbose" }, { "getmempooldescendants", 1, "verbose" }, + { "bumpfee", 1, "options" }, // Echo with conversion (For testing only) { "echojson", 0, "arg0" }, { "echojson", 1, "arg1" }, -- cgit v1.2.3