diff options
author | Andrew Chow <achow101-github@achow101.com> | 2018-09-11 00:13:19 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2018-09-22 15:27:01 -0400 |
commit | f8c1714634445542a16ac01d128d8ad2b2810e19 (patch) | |
tree | c495ff13685a3f5278fb7132e52b5a4d5c1f5712 /src/script/sign.cpp | |
parent | 2796c6e5ec9055545e987023b04eb5ebe64d5320 (diff) |
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.
Diffstat (limited to 'src/script/sign.cpp')
-rw-r--r-- | src/script/sign.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp index d779910425..83cc210b30 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) { |