templates: fix nullData return value
This commit is contained in:
parent
69d8e9ed9e
commit
ce5babde83
@ -21,7 +21,7 @@ function encode (data) {
|
|||||||
function decode (buffer) {
|
function decode (buffer) {
|
||||||
typeforce(check, buffer)
|
typeforce(check, buffer)
|
||||||
|
|
||||||
return buffer.slice(1)
|
return buffer.slice(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@ -348,16 +348,20 @@ describe('script-templates', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('nullData.output.encode', function () {
|
describe('nullData.output', function () {
|
||||||
fixtures.valid.forEach(function (f) {
|
fixtures.valid.forEach(function (f) {
|
||||||
if (f.type !== 'nulldata') return
|
if (f.type !== 'nulldata') return
|
||||||
|
|
||||||
var data = new Buffer(f.data, 'hex')
|
var data = new Buffer(f.data, 'hex')
|
||||||
var scriptPubKey = bscript.nullData.output.encode(data)
|
var scriptPubKey = bscript.nullData.output.encode(data)
|
||||||
|
|
||||||
it('returns ' + f.scriptPubKey, function () {
|
it('encodes to ' + f.scriptPubKey, function () {
|
||||||
assert.strictEqual(bscript.toASM(scriptPubKey), f.scriptPubKey)
|
assert.strictEqual(bscript.toASM(scriptPubKey), f.scriptPubKey)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('decodes to ' + f.data, function () {
|
||||||
|
assert.deepEqual(bscript.nullData.output.decode(scriptPubKey), data)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user