aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <[email protected]>2018-09-11 00:13:19 -0400
committerAndrew Chow <[email protected]>2018-09-22 15:27:01 -0400
commitf8c1714634445542a16ac01d128d8ad2b2810e19 (patch)
treec495ff13685a3f5278fb7132e52b5a4d5c1f5712 /src
parentMerge #14214: convert C-style (void) parameter lists to C++ style () (diff)
downloaddiscoin-f8c1714634445542a16ac01d128d8ad2b2810e19.tar.xz
discoin-f8c1714634445542a16ac01d128d8ad2b2810e19.zip
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')
-rw-r--r--src/script/sign.cpp5
1 files changed, 5 insertions, 0 deletions
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) {