Script classification fixes

This pull request fixes the classification functions in `scripts` to only accept canonical signatures and public keys, as well as puts them under more strict testing.
There isn't much testing for false positives, which is important to ensure does not occur, but we can add those cases as/if we get them.

A major point of annoyance was a triangular (circular) dependency issue formed by `scripts`, `Address` and `ECPubKey`.
The problem has been added as an inline comment in daa2cb7.
Cheers, will remove.  It was an artifact of previous recursion protection.
On Jun 29, 2014 9:29 AM, "Wei Lu" <notifications@github.com> wrote:

> In src/scripts.js:
>
> >      this.chunks[1] === opcodes.OP_CHECKSIG
> >  }
> >
> > -function isScripthash() {
> > -  return this.chunks[this.chunks.length - 1] == opcodes.OP_EQUAL &&
> > -    this.chunks[0] == opcodes.OP_HASH160 &&
> > +function isScriptHashInput() {
> > +  if (this.chunks.length < 2) return false
> > +  var lastChunk = this.chunks[this.chunks.length - 1]
> > +
> > +  if (!Buffer.isBuffer(lastChunk)) return false
> > +
> > +  var scriptSig = Script.fromChunks(this.chunks.slice(0, -1))
> > +  var scriptPubKey = Script.fromBuffer(lastChunk)
> > +
> > +  return classifyInput(scriptSig, false) === classifyOutput(scriptPubKey)
>
> 2nd argument false isn't used.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/bitcoinjs/bitcoinjs-lib/pull/224/files#r14326810>.
>