mirror of https://github.com/lukechilds/vainjs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1012 B
27 lines
1012 B
import test from 'ava';
|
|
import Vain from '..';
|
|
|
|
test('Vain lexicographically orders multisig pubkeys (BIP 67)', t => {
|
|
const origPubkeys = [
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000002', 'hex'),
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000001', 'hex'),
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000003', 'hex')
|
|
];
|
|
const options = {
|
|
keyFormat: 'multisig',
|
|
addressFormat: 'p2sh',
|
|
prefix: 'A',
|
|
pubkeys: origPubkeys,
|
|
m: 2
|
|
};
|
|
const vain = new Vain(options);
|
|
const {pubkeys} = vain.generate();
|
|
|
|
const origPubkeysSorted = pubkeys.filter(pubkey => origPubkeys.includes(pubkey));
|
|
|
|
t.deepEqual(origPubkeysSorted, [
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000001', 'hex'),
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000002', 'hex'),
|
|
Buffer.from('030000000000000000000000000000000000000000000000000000000000000003', 'hex')
|
|
]);
|
|
});
|
|
|