Skip to content

Instantly share code, notes, and snippets.

@oleganza
Created August 24, 2013 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleganza/6330117 to your computer and use it in GitHub Desktop.
Save oleganza/6330117 to your computer and use it in GitHub Desktop.
Some WTF moments when reading BitcoinQT source code. It's not to insult people, but to help others quickly understand why some things are done in some way.
1. CheckSig function and a dozen other pass around nHashType argument which means nothing - the nHashType is always read from the last byte of the signature. Nowhere in the code non-zero value is passed and even if it was passed, it must match the last byte.
if (nHashType == 0)
nHashType = vchSig.back();
else if (nHashType != vchSig.back())
return false;
2. OP_CODESEPARATOR cannot be meaningfully used, but we have to account for it till the end of times when computing a portion of a script for signature verification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment