Skip to content

Commit

Permalink
rpc: show both UTXOs in decodepsbt
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Jun 24, 2020
1 parent 67881de commit 72f6bec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 72f6bec

Please sign in to comment.