diff options
| author | Sjors Provoost <[email protected]> | 2019-07-11 18:50:45 +0100 |
|---|---|---|
| committer | Sjors Provoost <[email protected]> | 2020-09-07 20:33:16 +0200 |
| commit | 1bc8d0fd5906bc9637d513cd193a1f47ad94da28 (patch) | |
| tree | be9216ebdda7218dc910d5279b291434bf308cad /src/rpc | |
| parent | Merge #19478: Remove CTxMempool::mapLinks data structure member (diff) | |
| download | discoin-1bc8d0fd5906bc9637d513cd193a1f47ad94da28.tar.xz discoin-1bc8d0fd5906bc9637d513cd193a1f47ad94da28.zip | |
[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.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp index 1031716b4..cfe457509 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(); |