|
|
@ -1525,7 +1525,7 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType, CScript scriptPrereq) |
|
|
|
bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
assert(nIn < txTo.vin.size()); |
|
|
|
assert(nIn < txTo.vin.size()); |
|
|
|
CTxIn& txin = txTo.vin[nIn]; |
|
|
|
CTxIn& txin = txTo.vin[nIn]; |
|
|
@ -1534,18 +1534,15 @@ bool SignSignature(const CKeyStore &keystore, const CTransaction& txFrom, CTrans |
|
|
|
|
|
|
|
|
|
|
|
// Leave out the signature from the hash, since a signature can't sign itself.
|
|
|
|
// Leave out the signature from the hash, since a signature can't sign itself.
|
|
|
|
// The checksig op will also drop the signatures from its hash.
|
|
|
|
// The checksig op will also drop the signatures from its hash.
|
|
|
|
uint256 hash = SignatureHash(scriptPrereq + txout.scriptPubKey, txTo, nIn, nHashType); |
|
|
|
uint256 hash = SignatureHash(txout.scriptPubKey, txTo, nIn, nHashType); |
|
|
|
|
|
|
|
|
|
|
|
if (!Solver(keystore, txout.scriptPubKey, hash, nHashType, txin.scriptSig)) |
|
|
|
if (!Solver(keystore, txout.scriptPubKey, hash, nHashType, txin.scriptSig)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
txin.scriptSig = scriptPrereq + txin.scriptSig; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test solution
|
|
|
|
// Test solution
|
|
|
|
int nUnused = 0; |
|
|
|
int nUnused = 0; |
|
|
|
if (scriptPrereq.empty()) |
|
|
|
if (!VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, nIn, nUnused, 0, true)) |
|
|
|
if (!VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, nIn, nUnused, 0, true)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|