Implement BIP66 by sipa · Pull Request #5713 · bitcoin/bitcoin

See the corresponding BIP text (see bitcoin/bips#135) and mailing list discussion for details.