script parsing should be more loose on pushdata

This testnet transaction was being parsed incorrectly:

cc64de74ba7002bbf4e3646824d7bbf0920004fb2ce45aa7270c4116ff11b715

Script was throwing an error when it should not have been. The error was that
PUSHDATA1 was trying to push 117 bytes to the stack, but it was followed by
only 75 bytes. But this transaction is accepted as valid by bitcoin-qt on
testnet. So we are mistaken by throwing an error in this case.
This commit is contained in:
Ryan X. Charles 2014-03-24 20:18:08 -04:00
parent fa47ee9984
commit f89dcda0a2
1 changed files with 0 additions and 3 deletions

View File

@ -58,17 +58,14 @@ Script.prototype.parse = function() {
} else if (opcode === OP_PUSHDATA1) {
len = parser.word8();
chunk = parser.buffer(len);
if (chunk.length < len) throw new Error('Invalid data size: not enough data');
this.chunks.push(chunk);
} else if (opcode === OP_PUSHDATA2) {
len = parser.word16le();
chunk = parser.buffer(len);
if (chunk.length < len) throw new Error('Invalid data size: not enough data');
this.chunks.push(chunk);
} else if (opcode === OP_PUSHDATA4) {
len = parser.word32le();
chunk = parser.buffer(len);
if (chunk.length < len) throw new Error('Invalid data size: not enough data');
this.chunks.push(chunk);
} else {
this.chunks.push(opcode);