diff --git a/packages/bitcore-lib/lib/script/script.js b/packages/bitcore-lib/lib/script/script.js index 4d0ca41c7ea..fe6a213e9ad 100644 --- a/packages/bitcore-lib/lib/script/script.js +++ b/packages/bitcore-lib/lib/script/script.js @@ -167,8 +167,6 @@ Script.fromASM = function(str) { opcodenum=Opcode.OP_PUSHDATA2 }else if(buf.length <= 0x100000000){ opcodenum=Opcode.OP_PUSHDATA4 - }else{ - throw new Error('Pushdata data is too long'); } script.chunks.push({ buf: buf, diff --git a/packages/bitcore-lib/test/script/script.js b/packages/bitcore-lib/test/script/script.js index 1503f345d43..b4371016712 100644 --- a/packages/bitcore-lib/test/script/script.js +++ b/packages/bitcore-lib/test/script/script.js @@ -211,7 +211,8 @@ describe('Script', function() { const data3 = '01'.repeat(0x100+1) const data4 = '01'.repeat(0x10000) const data5 = '01'.repeat(0x10000+1) - var asm = `${data0} ${data1} ${data2} ${data3} ${data4} ${data5}`; + const data6 = '01'.repeat(1) + var asm = `${data0} ${data1} ${data2} ${data3} ${data4} ${data5} ${data6}`; var script = Script.fromASM(asm); script.chunks[0].opcodenum.should.equal(0x4b); script.chunks[1].opcodenum.should.equal(Opcode.OP_PUSHDATA1); @@ -224,6 +225,8 @@ describe('Script', function() { script.chunks[4].len.should.equal(0x10000); script.chunks[5].opcodenum.should.equal(Opcode.OP_PUSHDATA4); script.chunks[5].len.should.equal(0x10000+1); + script.chunks[6].opcodenum.should.equal(1); + script.chunks[6].len.should.equal(1); }); });