Convert non-witness UTXOs to witness if witness sig created
If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
This commit is contained in:
parent
fcdea8ad2a
commit
fcefc6851a
1 changed files with 7 additions and 0 deletions
|
@ -4525,6 +4525,13 @@ bool FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& psbtx, const C
|
||||||
complete &= SignPSBTInput(PublicOnlySigningProvider(pwallet), *psbtx.tx, input, sigdata, i, sighash_type);
|
complete &= SignPSBTInput(PublicOnlySigningProvider(pwallet), *psbtx.tx, input, sigdata, i, sighash_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 both UTXO types are present, drop the unnecessary one.
|
||||||
if (input.non_witness_utxo && !input.witness_utxo.IsNull()) {
|
if (input.non_witness_utxo && !input.witness_utxo.IsNull()) {
|
||||||
if (sigdata.witness) {
|
if (sigdata.witness) {
|
||||||
|
|
Loading…
Reference in a new issue