aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2019-07-11 18:50:45 +0100
committerSjors Provoost <sjors@sprovoost.nl>2020-09-07 20:33:16 +0200
commit1bc8d0fd5906bc9637d513cd193a1f47ad94da28 (patch)
treebe9216ebdda7218dc910d5279b291434bf308cad /src/rpc
parent25839661305ec9fe8c25d171e31270d95311a4e4 (diff)
[rpc] walletcreatefundedpsbt: allow inputs to be null
This is of neglible use here, but it allows new RPC methods to take outputs as their first argument and make inputs optional.
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/rawtransaction_util.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp
index 1031716b4a..cfe4575090 100644
--- a/src/rpc/rawtransaction_util.cpp
+++ b/src/rpc/rawtransaction_util.cpp
@@ -21,10 +21,15 @@
CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, bool rbf)
{
- if (inputs_in.isNull() || outputs_in.isNull())
- throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null");
+ if (outputs_in.isNull())
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, output argument must be non-null");
+
+ UniValue inputs;
+ if (inputs_in.isNull())
+ inputs = UniValue::VARR;
+ else
+ inputs = inputs_in.get_array();
- UniValue inputs = inputs_in.get_array();
const bool outputs_is_obj = outputs_in.isObject();
UniValue outputs = outputs_is_obj ? outputs_in.get_obj() : outputs_in.get_array();