mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
rpc: show both UTXOs in decodepsbt
This commit is contained in:
parent
67881de0e3
commit
72f6bec1da
@ -1104,6 +1104,7 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
|||||||
const PSBTInput& input = psbtx.inputs[i];
|
const PSBTInput& input = psbtx.inputs[i];
|
||||||
UniValue in(UniValue::VOBJ);
|
UniValue in(UniValue::VOBJ);
|
||||||
// UTXOs
|
// UTXOs
|
||||||
|
bool have_a_utxo = false;
|
||||||
if (!input.witness_utxo.IsNull()) {
|
if (!input.witness_utxo.IsNull()) {
|
||||||
const CTxOut& txout = input.witness_utxo;
|
const CTxOut& txout = input.witness_utxo;
|
||||||
|
|
||||||
@ -1121,7 +1122,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
|||||||
ScriptToUniv(txout.scriptPubKey, o, true);
|
ScriptToUniv(txout.scriptPubKey, o, true);
|
||||||
out.pushKV("scriptPubKey", o);
|
out.pushKV("scriptPubKey", o);
|
||||||
in.pushKV("witness_utxo", out);
|
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);
|
UniValue non_wit(UniValue::VOBJ);
|
||||||
TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false);
|
TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false);
|
||||||
in.pushKV("non_witness_utxo", non_wit);
|
in.pushKV("non_witness_utxo", non_wit);
|
||||||
@ -1132,7 +1135,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
|||||||
// Hack to just not show fee later
|
// Hack to just not show fee later
|
||||||
have_all_utxos = false;
|
have_all_utxos = false;
|
||||||
}
|
}
|
||||||
} else {
|
have_a_utxo = true;
|
||||||
|
}
|
||||||
|
if (!have_a_utxo) {
|
||||||
have_all_utxos = false;
|
have_all_utxos = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user