diff options
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9ddd21126a..0a9242327b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4534,8 +4534,15 @@ bool FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& psbtx, const C complete &= SignPSBTInput(PublicOnlySigningProvider(pwallet), *psbtx.tx, input, sigdata, i, sighash_type); } - if (it != pwallet->mapWallet.end()) { - // Drop the unnecessary UTXO if we added both from the wallet. + if (sigdata.witness) { + // Convert the non-witness utxo to witness + if (input.witness_utxo.IsNull() && input.non_witness_utxo) { + input.witness_utxo = input.non_witness_utxo->vout[txin.prevout.n]; + } + } + + // If both UTXO types are present, drop the unnecessary one. + if (input.non_witness_utxo && !input.witness_utxo.IsNull()) { if (sigdata.witness) { input.non_witness_utxo = nullptr; } else { |