bufferutils: return opcode for use
This commit is contained in:
parent
13f95d4ecf
commit
7e9b5d8584
2 changed files with 3 additions and 0 deletions
|
@ -37,6 +37,7 @@ function readPushDataInt(buffer, offset) {
|
|||
}
|
||||
|
||||
return {
|
||||
opcode: opcode,
|
||||
number: number,
|
||||
size: size
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ describe('bufferutils', function() {
|
|||
it('decodes ' + f.hexPD + ' correctly', function() {
|
||||
var buffer = new Buffer(f.hexPD, 'hex')
|
||||
var d = bufferutils.readPushDataInt(buffer, 0)
|
||||
var fopcode = parseInt(f.hexPD.substr(0, 2), 16)
|
||||
|
||||
assert.equal(d.opcode, fopcode)
|
||||
assert.equal(d.number, f.dec)
|
||||
assert.equal(d.size, buffer.length)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue