Skip to content

Commit 72f6bec

Browse files
committed
rpc: show both UTXOs in decodepsbt
1 parent 67881de commit 72f6bec

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11041104
const PSBTInput& input = psbtx.inputs[i];
11051105
UniValue in(UniValue::VOBJ);
11061106
// UTXOs
1107+
bool have_a_utxo = false;
11071108
if (!input.witness_utxo.IsNull()) {
11081109
const CTxOut& txout = input.witness_utxo;
11091110

@@ -1121,7 +1122,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11211122
ScriptToUniv(txout.scriptPubKey, o, true);
11221123
out.pushKV("scriptPubKey", o);
11231124
in.pushKV("witness_utxo", out);
1124-
} else if (input.non_witness_utxo) {
1125+
have_a_utxo = true;
1126+
}
1127+
if (input.non_witness_utxo) {
11251128
UniValue non_wit(UniValue::VOBJ);
11261129
TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false);
11271130
in.pushKV("non_witness_utxo", non_wit);
@@ -1132,7 +1135,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11321135
// Hack to just not show fee later
11331136
have_all_utxos = false;
11341137
}
1135-
} else {
1138+
have_a_utxo = true;
1139+
}
1140+
if (!have_a_utxo) {
11361141
have_all_utxos = false;
11371142
}
11381143

0 commit comments

Comments
 (0)