tests: test non-standard pathway for classifyInput

This commit is contained in:
Daniel Cousens 2014-10-13 19:51:13 +11:00
parent ddb24ee615
commit f3138dcb68
2 changed files with 17 additions and 0 deletions

View file

@ -95,6 +95,10 @@
{
"description": "multisig output : non-canonical pubKey (bad length)",
"scriptPubKey": "OP_1 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ffff OP_1 OP_CHECKMULTISIG"
},
{
"description": "pubKeyHash input : extraneous data",
"scriptSig": "304402207515cf147d201f411092e6be5a64a6006f9308fad7b2a8fdaab22cd86ce764c202200974b8aca7bf51dbf54150d3884e1ae04f675637b926ec33bf75939446f6ca2801 02359c6e3f04cefbf089cf1d6670dc47c3fb4df68e2bad1fa5a369f9ce4b42bbd1 ffffffff"
}
],
"multisig": [

View file

@ -19,6 +19,17 @@ describe('Scripts', function() {
assert.equal(type, f.type)
})
})
fixtures.invalid.classify.forEach(function(f) {
if (!f.scriptSig) return
it('returns nonstandard for ' + f.description, function() {
var script = Script.fromASM(f.scriptSig)
var type = scripts.classifyInput(script)
assert.equal(type, 'nonstandard')
})
})
})
describe('classifyOutput', function() {
@ -34,6 +45,8 @@ describe('Scripts', function() {
})
fixtures.invalid.classify.forEach(function(f) {
if (!f.scriptPubKey) return
it('returns nonstandard for ' + f.description, function() {
var script = Script.fromASM(f.scriptPubKey)
var type = scripts.classifyOutput(script)