Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Potential Error in Script.isDataOut #267

Open
micahriggan opened this issue Nov 12, 2018 · 2 comments
Open

Potential Error in Script.isDataOut #267

micahriggan opened this issue Nov 12, 2018 · 2 comments

Comments

@micahriggan
Copy link
Contributor

micahriggan commented Nov 12, 2018

this.chunks[1].length === this.chunks.len

this line should probably be

this.chunks[1].len === this.chunks.length

this.chunks[1].length === this.chunks.len));

@matiu
Copy link
Contributor

matiu commented Nov 12, 2018

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:

it('validates that this 40-byte OP_RETURN is standard', function() {

@matiu
Copy link
Contributor

matiu commented Nov 12, 2018

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));

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants