Browse Source

Test p2pkh is default address format

master
Luke Childs 6 years ago
parent
commit
ac2df625bb
  1. 14
      test/unit.js

14
test/unit.js

@ -55,3 +55,17 @@ test('Vain derives a p2wpkh vanity address', async t => {
t.true(address.startsWith(`bc1q${options.prefix}`));
t.is(address, wifAddress);
});
test('Vain defaults to p2pkh if no address format is set', async t => {
const options = {
prefix: 'A'
};
const vain = new Vain(options);
const {address, wif} = await vain.start();
const keyPair = bitcoin.ECPair.fromWIF(wif);
const {address: wifAddress} = bitcoin.payments.p2pkh({pubkey: keyPair.publicKey});
t.true(address.startsWith(`1${options.prefix}`));
t.is(address, wifAddress);
});

Loading…
Cancel
Save