Potential Error in Script.isDataOut
this.chunks[1].length === this.chunks.len
this line should probably be
this.chunks[1].len === this.chunks.length
https://github.com/bitpay/bitcore-lib/blob/86583608814dfc513e675d7b853806caf9bd95e7/lib/script/script.js#L514
I am testing this for a valid script, and I get:
console.log('[script.js.465]', this.chunks[1].length , this.chunks.len);
=> undefined, undefined.
So it is wrong it both sides. See tests at:
https://github.com/bitpay/bitcore-lib/blob/86583608814dfc513e675d7b853806caf9bd95e7/test/script/script.js#L268
I dont understand the point of that test, I think we should remove it, leaving the line as:
return this.chunks.length >= 1 && this.chunks[0].opcodenum === Opcode.OP_RETURN && (this.chunks.length === 1 || (this.chunks.length === 2 && this.chunks[1].buf && this.chunks[1].buf.length <= Script.OP_RETURN_STANDARD_SIZE));