diff options
author | Pieter Wuille <pieter@wuille.net> | 2021-02-27 20:26:54 -0800 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2021-06-12 12:25:28 -0700 |
commit | 5d2e22437b22e7465ae4be64069443bcc1769dc9 (patch) | |
tree | e069abc3807ac4de283ff117f8600e85c1650c19 /src | |
parent | ce9353164bdb6215a62b2b6dcb2121d331796f60 (diff) |
Don't nuke witness data when signing fails
Diffstat (limited to 'src')
-rw-r--r-- | src/script/sign.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp index fe5cec89b0..d711f8997b 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -217,7 +217,6 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato bool solved = SignStep(provider, creator, fromPubKey, result, whichType, SigVersion::BASE, sigdata); bool P2SH = false; CScript subscript; - sigdata.scriptWitness.stack.clear(); if (solved && whichType == TxoutType::SCRIPTHASH) { @@ -254,6 +253,7 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato sigdata.witness = true; } + if (!sigdata.witness) sigdata.scriptWitness.stack.clear(); if (P2SH) { result.push_back(std::vector<unsigned char>(subscript.begin(), subscript.end())); } |