bitcoinjs/bitcoinjs-lib — pull request #125 by sidazhang (2014-04-11 22:24:02+00:00)
Title: Aligning type naming with bitcoind and fixed pubkeyhash bug

All tests pass with the modifications. I noticed a few other bugs. But I want to get this pull request reviewed first before I move further as this is my first pull request to this repo.

Conventions:

The script types are currently:
https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/script.js#L117-L133

Bitcoind uses these following names:
https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L75-L87

Bug:

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/script.js#L123-L127

It is possible for the third item in a pubkeyhash script to be a OP_0, for example in this transaction:

e.g.:
http://testnet.helloblock.io/transactions/a347b4ef02173b74deb096921d8306ff7c379c254e9febaa040024b220a348ed
One of the output scripts: 76a90088ac

The above is a nonstandard script that reads: OP_DUP OP_HASH160 0 OP_EQUALVERIFY OP_CHECKSIG, I believe this also appears in a number of places on mainnet

I believe we also need:
Array.isArray(this.chunks[2]) && this.chunks[2].length === 20