Skip to content

Commit f8c1714

Browse files
committed
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.
1 parent 2796c6e commit f8c1714

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/script/sign.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& t
277277
if (require_witness_sig && !sigdata.witness) return false;
278278
input.FromSignatureData(sigdata);
279279

280+
if (sigdata.witness) {
281+
assert(!utxo.IsNull());
282+
input.witness_utxo = utxo;
283+
}
284+
280285
// If both UTXO types are present, drop the unnecessary one.
281286
if (input.non_witness_utxo && !input.witness_utxo.IsNull()) {
282287
if (sigdata.witness) {

0 commit comments

Comments
 (0)