Fix incorrect address generation for altcoins with bip38

This commit is contained in:
woodser
2018-05-18 10:26:54 -04:00
parent 35d9e9fddc
commit 29c30bf33a

View File

@@ -813,7 +813,7 @@
var keyPair = key.keyPair;
var useUncompressed = useBip38;
if (useUncompressed) {
keyPair = new bitcoinjs.bitcoin.ECPair(keyPair.d, null, { compressed: false });
keyPair = new bitcoinjs.bitcoin.ECPair(keyPair.d, null, { network: network, compressed: false });
}
// get address
var address = keyPair.getAddress().toString();
@@ -821,7 +821,7 @@
var hasPrivkey = !key.isNeutered();
var privkey = "NA";
if (hasPrivkey) {
privkey = keyPair.toWIF(network);
privkey = keyPair.toWIF();
// BIP38 encode private key if required
if (useBip38) {
privkey = bitcoinjsBip38.encrypt(keyPair.d.toBuffer(), false, bip38password, function(p) {