standardize test descriptions & add nonstandard script test vector
[follow-up #125]
This commit is contained in:
parent
9e15b490e5
commit
c3d95010ae
1 changed files with 19 additions and 13 deletions
|
@ -15,16 +15,17 @@ describe('Script', function() {
|
||||||
pubkeyScriptPubKey = "76a9145a3acbc7bbcc97c5ff16f5909c9d7d3fadb293a888ac"
|
pubkeyScriptPubKey = "76a9145a3acbc7bbcc97c5ff16f5909c9d7d3fadb293a888ac"
|
||||||
addressScriptSig = "48304502206becda98cecf7a545d1a640221438ff8912d9b505ede67e0138485111099f696022100ccd616072501310acba10feb97cecc918e21c8e92760cd35144efec7622938f30141040cd2d2ce17a1e9b2b3b2cb294d40eecf305a25b7e7bfdafae6bb2639f4ee399b3637706c3d377ec4ab781355add443ae864b134c5e523001c442186ea60f0eb8"
|
addressScriptSig = "48304502206becda98cecf7a545d1a640221438ff8912d9b505ede67e0138485111099f696022100ccd616072501310acba10feb97cecc918e21c8e92760cd35144efec7622938f30141040cd2d2ce17a1e9b2b3b2cb294d40eecf305a25b7e7bfdafae6bb2639f4ee399b3637706c3d377ec4ab781355add443ae864b134c5e523001c442186ea60f0eb8"
|
||||||
|
|
||||||
// https://helloblock.io/transactions/09dd94f2c85262173da87a745a459007bb1eed6eeb6bfa238a0cd91a16cf7790
|
// txid: 09dd94f2c85262173da87a745a459007bb1eed6eeb6bfa238a0cd91a16cf7790
|
||||||
validMultisigScript = '5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae'
|
validMultisigScript = '5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae'
|
||||||
|
|
||||||
// https://helloblock.io/transactions/dfa8ff97f33cb83dbaa22ed3a99883218d6afd681d486b374496d145b39a63b7
|
// txid: 5e9be7fb36ee49ce84bee4c8ef38ad0efc0608b78dae1c2c99075297ef527890
|
||||||
|
opreturnScript = '6a2606deadbeef03f895a2ad89fb6d696497af486cb7c644a27aa568c7a18dd06113401115185474'
|
||||||
|
|
||||||
// asm: "0 0 0 OP_CHECKMULTISIG"
|
// asm: "0 0 0 OP_CHECKMULTISIG"
|
||||||
invalidMultisigScript = '000000ae'
|
invalidMultisigScript = '000000ae'
|
||||||
|
|
||||||
// https://helloblock.io/transactions/5e9be7fb36ee49ce84bee4c8ef38ad0efc0608b78dae1c2c99075297ef527890
|
// txid: a4bfa8ab6435ae5f25dae9d89e4eb67dfa94283ca751f393c1ddc5a837bbc31b
|
||||||
// op_return
|
nonStandardScript = 'aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087'
|
||||||
opreturnScript = '6a2606deadbeef03f895a2ad89fb6d696497af486cb7c644a27aa568c7a18dd06113401115185474'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
|
@ -42,29 +43,34 @@ describe('Script', function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getOutType', function() {
|
describe('getOutType', function() {
|
||||||
it('works for p2sh', function() {
|
it('supports p2sh', function() {
|
||||||
var script = Script.fromHex(p2shScriptPubKey)
|
var script = Script.fromHex(p2shScriptPubKey)
|
||||||
assert.equal(script.getOutType(), 'scripthash')
|
assert.equal(script.getOutType(), 'scripthash')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('works for pubkeyhash', function() {
|
it('supports pubkeyhash', function() {
|
||||||
var script = Script.fromHex(pubkeyScriptPubKey)
|
var script = Script.fromHex(pubkeyScriptPubKey)
|
||||||
assert.equal(script.getOutType(), 'pubkeyhash')
|
assert.equal(script.getOutType(), 'pubkeyhash')
|
||||||
})
|
})
|
||||||
|
|
||||||
it(' > Supports Multisig', function() {
|
it('supports multisig', function() {
|
||||||
var script = Script.fromHex(validMultisigScript)
|
var script = Script.fromHex(validMultisigScript)
|
||||||
assert.equal(script.getOutType(), 'multisig')
|
assert.equal(script.getOutType(), 'multisig')
|
||||||
})
|
})
|
||||||
|
|
||||||
it(' > Supports invalid Multisig', function() {
|
it('supports null_data', function() {
|
||||||
var script = Script.fromHex(invalidMultisigScript)
|
var script = Script.fromHex(opreturnScript)
|
||||||
|
assert.equal(script.getOutType(), 'nulldata')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('supports nonstandard script', function() {
|
||||||
|
var script = Script.fromHex(nonStandardScript)
|
||||||
assert.equal(script.getOutType(), 'nonstandard')
|
assert.equal(script.getOutType(), 'nonstandard')
|
||||||
})
|
})
|
||||||
|
|
||||||
it(' > Supports null_data (OP_RETURN)', function() {
|
it('identifies invalid multisig script as nonstandard', function() {
|
||||||
var script = Script.fromHex(opreturnScript)
|
var script = Script.fromHex(invalidMultisigScript)
|
||||||
assert.equal(script.getOutType(), 'nulldata')
|
assert.equal(script.getOutType(), 'nonstandard')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue