diff options
| author | Andrew Chow <[email protected]> | 2020-06-04 23:43:25 -0400 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2020-06-24 16:31:42 -0400 |
| commit | 72f6bec1da198764d4648a10a61c485e7ab65e9e (patch) | |
| tree | 89e77a5c2d41ecac8d2ee764434fbfb676a5ff95 /src/rpc/rawtransaction.cpp | |
| parent | Merge #19272: net, test: invalid p2p messages and test framework improvements (diff) | |
| download | discoin-72f6bec1da198764d4648a10a61c485e7ab65e9e.tar.xz discoin-72f6bec1da198764d4648a10a61c485e7ab65e9e.zip | |
rpc: show both UTXOs in decodepsbt
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
| -rw-r--r-- | src/rpc/rawtransaction.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index a53b91c4b..858cb6485 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1104,6 +1104,7 @@ UniValue decodepsbt(const JSONRPCRequest& request) const PSBTInput& input = psbtx.inputs[i]; UniValue in(UniValue::VOBJ); // UTXOs + bool have_a_utxo = false; if (!input.witness_utxo.IsNull()) { const CTxOut& txout = input.witness_utxo; @@ -1121,7 +1122,9 @@ UniValue decodepsbt(const JSONRPCRequest& request) ScriptToUniv(txout.scriptPubKey, o, true); out.pushKV("scriptPubKey", o); in.pushKV("witness_utxo", out); - } else if (input.non_witness_utxo) { + have_a_utxo = true; + } + if (input.non_witness_utxo) { UniValue non_wit(UniValue::VOBJ); TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false); in.pushKV("non_witness_utxo", non_wit); @@ -1132,7 +1135,9 @@ UniValue decodepsbt(const JSONRPCRequest& request) // Hack to just not show fee later have_all_utxos = false; } - } else { + have_a_utxo = true; + } + if (!have_a_utxo) { have_all_utxos = false; } |