|
|
@ -409,10 +409,24 @@ describe('Script', function() { |
|
|
|
'036a98a36aa7665874b1ba9130bc6d318e52fd3bdb5969532d7fc09bf2476ff842', |
|
|
|
'033aafcbead78c08b0e0aacc1b0cdb40702a7c709b660bebd286e973242127e15b', |
|
|
|
]; |
|
|
|
var sortkeys = pubkey_hexs.slice(0, 3).map(PublicKey); |
|
|
|
it('should create sorted script by default', function() { |
|
|
|
var s = Script.buildMultisigOut(sortkeys, 2); |
|
|
|
s.toString().should.equal('OP_2 33 0x021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18 33 0x022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da 33 0x03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9 OP_3 OP_CHECKMULTISIG'); |
|
|
|
s.isMultisigOut().should.equal(true); |
|
|
|
}); |
|
|
|
it('should create unsorted script if specified', function() { |
|
|
|
var s = Script.buildMultisigOut(sortkeys, 2); |
|
|
|
var u = Script.buildMultisigOut(sortkeys, 2, { |
|
|
|
noSorting: true |
|
|
|
}); |
|
|
|
s.toString().should.not.equal(u.toString()); |
|
|
|
u.toString().should.equal('OP_2 33 0x022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da 33 0x03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9 33 0x021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18 OP_3 OP_CHECKMULTISIG'); |
|
|
|
s.isMultisigOut().should.equal(true); |
|
|
|
}); |
|
|
|
var test_mn = function(m, n) { |
|
|
|
var pubkeys = pubkey_hexs.slice(0, n).map(PublicKey); |
|
|
|
var s = Script.buildMultisigOut(pubkeys, m); |
|
|
|
should.exist(s); |
|
|
|
s.isMultisigOut().should.equal(true); |
|
|
|
}; |
|
|
|
for (var n = 1; n < 6; n++) { |
|
|
@ -494,5 +508,10 @@ describe('Script', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('#removeCodeseparators', function() { |
|
|
|
it('should remove any OP_CODESEPARATORs', function() { |
|
|
|
Script('OP_CODESEPARATOR OP_0 OP_CODESEPARATOR').removeCodeseparators().toString().should.equal('OP_0'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|