-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Script.fromASM support PUSHDATA #3807
base: master
Are you sure you want to change the base?
Changes from 1 commit
5eec04d
28e2706
8454815
70427e4
ad2071d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,25 @@ describe('Script', function() { | |
}); | ||
}); | ||
|
||
describe('#fromASM PUSHDATA', function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is already a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
it('should parse this known script in ASM', function() { | ||
const data0 = '01'.repeat(0x4b) | ||
const data1 = '01'.repeat(0x100) | ||
const data2 = '01'.repeat(0x10000) | ||
const data3 = '01'.repeat(0x10000+1) | ||
var asm = `${data0} ${data1} ${data2} ${data3}`; | ||
var script = Script.fromASM(asm); | ||
console.log("🚀 ~ it ~ script:", script) | ||
script.chunks[0].opcodenum.should.equal(0x4b); | ||
script.chunks[1].opcodenum.should.equal(Opcode.OP_PUSHDATA1); | ||
script.chunks[1].len.should.equal(0x100); | ||
script.chunks[2].opcodenum.should.equal(Opcode.OP_PUSHDATA2); | ||
script.chunks[2].len.should.equal(0x10000); | ||
script.chunks[3].opcodenum.should.equal(Opcode.OP_PUSHDATA4); | ||
script.chunks[3].len.should.equal(0x10000+1); | ||
}); | ||
}); | ||
|
||
describe('#fromString', function() { | ||
|
||
it('should parse these known scripts', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency and for linting, would you mind just copying the code from the bitcore-lib-cash script.js? Feel free to clean it up a little (don't need to re-declare opcodenum, for example), but your code here has some inconsistent formatting/linting with the rest of the codebase.