bitcoinjs/bitcoinjs-lib — pull request #199 by dcousens (2014-05-28 16:06:31+00:00)
Title: Bitcoin core tests and fixed exception testing

This pull request primarily adds a large portion of the core Bitcoin tests (aka, reference client), and makes some minor changes to `Transaction.hashForSignature` to ensure it can pass these tests.
To do this, some new functionality was added:

* `Script.fromChunks`, required only by `without` for now, this function will likely be the backbone behind the entire of `Script`, avoiding the necessity to `parse` Scripts entirely, and removing all mutable functionality within `Script`.
* `Script.prototype.without`, similar in functionality to `CScript.findAndDelete` in the reference client, however fundamentally just a filter over the `script.chunks`. This was made easy by `Script.fromChunks`.
* `bufferutils.readPushDataInt`
* `bufferutils.writePushDataInt`
* `bufferutils.pushDataSize`

All with appropriate tests. (`Script.fromChunks` will be receiving more, but it covers the basics for now).

Finally, a change required to pass the tests was the fix up of the `Transaction` constant `SIGHASH_ANYONECANPAY`, which appears to have been incorrect since the `0.1.3` tag (and no doubt since this programs creation).