From f8c1714634445542a16ac01d128d8ad2b2810e19 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Tue, 11 Sep 2018 00:13:19 -0400 Subject: [PATCH] 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. --- src/script/sign.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index d77991042..83cc210b3 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -277,6 +277,11 @@ bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& t if (require_witness_sig && !sigdata.witness) return false; input.FromSignatureData(sigdata); + if (sigdata.witness) { + assert(!utxo.IsNull()); + input.witness_utxo = utxo; + } + // If both UTXO types are present, drop the unnecessary one. if (input.non_witness_utxo && !input.witness_utxo.IsNull()) { if (sigdata.witness) {