Skip to content

Commit 68e0e6f

Browse files
achow101fanquake
authored andcommitted
rpc: show both UTXOs in decodepsbt
Github-Pull: #19215 Rebased-From: 72f6bec
1 parent 27786d0 commit 68e0e6f

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
@@ -1116,6 +1116,7 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11161116
const PSBTInput& input = psbtx.inputs[i];
11171117
UniValue in(UniValue::VOBJ);
11181118
// UTXOs
1119+
bool have_a_utxo = false;
11191120
if (!input.witness_utxo.IsNull()) {
11201121
const CTxOut& txout = input.witness_utxo;
11211122

@@ -1133,7 +1134,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11331134
ScriptToUniv(txout.scriptPubKey, o, true);
11341135
out.pushKV("scriptPubKey", o);
11351136
in.pushKV("witness_utxo", out);
1136-
} else if (input.non_witness_utxo) {
1137+
have_a_utxo = true;
1138+
}
1139+
if (input.non_witness_utxo) {
11371140
UniValue non_wit(UniValue::VOBJ);
11381141
TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false);
11391142
in.pushKV("non_witness_utxo", non_wit);
@@ -1144,7 +1147,9 @@ UniValue decodepsbt(const JSONRPCRequest& request)
11441147
// Hack to just not show fee later
11451148
have_all_utxos = false;
11461149
}
1147-
} else {
1150+
have_a_utxo = true;
1151+
}
1152+
if (!have_a_utxo) {
11481153
have_all_utxos = false;
11491154
}
11501155

0 commit comments

Comments
 (0)