Merge pull request #1335 from adjoinant/fix/is_multisig

fix issue with validation within Script.isMultisigIn()
This commit is contained in:
Braydon Fuller 2015-10-13 16:00:02 -04:00
commit 1e6e5d1f1f
2 changed files with 3 additions and 3 deletions

View File

@ -388,7 +388,7 @@ Script.prototype.isScriptHashOut = function() {
buf[buf.length - 1] === Opcode.OP_EQUAL);
};
/**
/**
* @returns {boolean} if this is a p2sh input script
* Note that these are frequently indistinguishable from pubkeyhashin
*/
@ -438,7 +438,7 @@ Script.prototype.isMultisigIn = function() {
this.chunks.slice(1, this.chunks.length).every(function(obj) {
return obj.buf &&
BufferUtil.isBuffer(obj.buf) &&
obj.buf.length === 0x47;
Signature.isTxDER(obj.buf);
});
};

View File

@ -347,7 +347,7 @@ describe('Script', function() {
Script('OP_0 0x47 0x3044022002a27769ee33db258bdf7a3792e7da4143ec4001b551f73e6a190b8d1bde449d02206742c56ccd94a7a2e16ca52fc1ae4a0aa122b0014a867a80de104f9cb18e472c01').isMultisigIn().should.equal(true);
});
it('should identify multisig in 2', function() {
Script('OP_0 0x47 0x3044022002a27769ee33db258bdf7a3792e7da4143ec4001b551f73e6a190b8d1bde449d02206742c56ccd94a7a2e16ca52fc1ae4a0aa122b0014a867a80de104f9cb18e472c01 0x47 30450220357011fd3b3ad2b8f2f2d01e05dc6108b51d2a245b4ef40c112d6004596f0475022100a8208c93a39e0c366b983f9a80bfaf89237fcd64ca543568badd2d18ee2e1d7501').isMultisigIn().should.equal(true);
Script('OP_0 0x47 0x3044022002a27769ee33db258bdf7a3792e7da4143ec4001b551f73e6a190b8d1bde449d02206742c56ccd94a7a2e16ca52fc1ae4a0aa122b0014a867a80de104f9cb18e472c01 0x48 0x30450220357011fd3b3ad2b8f2f2d01e05dc6108b51d2a245b4ef40c112d6004596f0475022100a8208c93a39e0c366b983f9a80bfaf89237fcd64ca543568badd2d18ee2e1d7501').isMultisigIn().should.equal(true);
});
it('should identify non-multisig in 1', function() {
Script('0x47 0x3044022002a27769ee33db258bdf7a3792e7da4143ec4001b551f73e6a190b8d1bde449d02206742c56ccd94a7a2e16ca52fc1ae4a0aa122b0014a867a80de104f9cb18e472c01').isMultisigIn().should.equal(false);