mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 15:27:57 +00:00
Merge pull request #2031 from gavinandresen/scriptcomment
Add assert and comment for subtle pay-to-script-hash logic
This commit is contained in:
commit
edf6ba2690
@ -1658,6 +1658,11 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C
|
|||||||
if (!scriptSig.IsPushOnly()) // scriptSig must be literals-only
|
if (!scriptSig.IsPushOnly()) // scriptSig must be literals-only
|
||||||
return false; // or validation fails
|
return false; // or validation fails
|
||||||
|
|
||||||
|
// stackCopy cannot be empty here, because if it was the
|
||||||
|
// P2SH HASH <> EQUAL scriptPubKey would be evaluated with
|
||||||
|
// an empty stack and the EvalScript above would return false.
|
||||||
|
assert(!stackCopy.empty());
|
||||||
|
|
||||||
const valtype& pubKeySerialized = stackCopy.back();
|
const valtype& pubKeySerialized = stackCopy.back();
|
||||||
CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end());
|
CScript pubKey2(pubKeySerialized.begin(), pubKeySerialized.end());
|
||||||
popstack(stackCopy);
|
popstack(stackCopy);
|
||||||
|
Loading…
Reference in New Issue
Block a user