Skip to content

Commit 4914933

Browse files
laanwjDuddino
authored andcommitted
Drop extra script variable in ProduceSignature (bitcoin#11889)
1 parent 52bb79a commit 4914933

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/script/sign.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,18 @@ static CScript PushAll(const std::vector<valtype>& values)
152152

153153
bool ProduceSignature(const BaseSignatureCreator& creator, const CScript& fromPubKey, SignatureData& sigdata, SigVersion sigversion, bool fColdStake, ScriptError* serror)
154154
{
155-
CScript script = fromPubKey;
156-
bool solved = true;
157155
std::vector<valtype> result;
158156
txnouttype whichType;
159-
solved = SignStep(creator, script, result, whichType, sigversion, fColdStake);
157+
bool solved = SignStep(creator, fromPubKey, result, whichType, sigversion, fColdStake);
160158
CScript subscript;
161159

162160
if (solved && whichType == TX_SCRIPTHASH)
163161
{
164162
// Solver returns the subscript that needs to be evaluated;
165163
// the final scriptSig is the signatures from that
166164
// and then the serialized subscript:
167-
script = subscript = CScript(result[0].begin(), result[0].end());
168-
solved = solved && SignStep(creator, script, result, whichType, sigversion, fColdStake) && whichType != TX_SCRIPTHASH;
165+
subscript = CScript(result[0].begin(), result[0].end());
166+
solved = solved && SignStep(creator, subscript, result, whichType, sigversion, fColdStake) && whichType != TX_SCRIPTHASH;
169167
result.emplace_back(subscript.begin(), subscript.end());
170168
}
171169

0 commit comments

Comments
 (0)