aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-06-04 23:43:25 -0400
committerfanquake <fanquake@gmail.com>2020-07-03 09:15:42 +0800
commit68e0e6f85247c8b9e0b0f039bc31c434632c2982 (patch)
tree1d057bf971ee0cdf01aad46752e37d24fc09b166
parent27786d072dbcf65cba9110f1dd171f94b6abc107 (diff)
rpc: show both UTXOs in decodepsbt
Github-Pull: #19215 Rebased-From: 72f6bec1da198764d4648a10a61c485e7ab65e9e
-rw-r--r--src/rpc/rawtransaction.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 3c0b060439..746900fdab 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1116,6 +1116,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;
@@ -1133,7 +1134,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);
@@ -1144,7 +1147,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;
}