mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-18 08:22:16 +00:00
Fix incorrect address generation for altcoins with bip38
This commit is contained in:
@@ -813,7 +813,7 @@
|
|||||||
var keyPair = key.keyPair;
|
var keyPair = key.keyPair;
|
||||||
var useUncompressed = useBip38;
|
var useUncompressed = useBip38;
|
||||||
if (useUncompressed) {
|
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
|
// get address
|
||||||
var address = keyPair.getAddress().toString();
|
var address = keyPair.getAddress().toString();
|
||||||
@@ -821,7 +821,7 @@
|
|||||||
var hasPrivkey = !key.isNeutered();
|
var hasPrivkey = !key.isNeutered();
|
||||||
var privkey = "NA";
|
var privkey = "NA";
|
||||||
if (hasPrivkey) {
|
if (hasPrivkey) {
|
||||||
privkey = keyPair.toWIF(network);
|
privkey = keyPair.toWIF();
|
||||||
// BIP38 encode private key if required
|
// BIP38 encode private key if required
|
||||||
if (useBip38) {
|
if (useBip38) {
|
||||||
privkey = bitcoinjsBip38.encrypt(keyPair.d.toBuffer(), false, bip38password, function(p) {
|
privkey = bitcoinjsBip38.encrypt(keyPair.d.toBuffer(), false, bip38password, function(p) {
|
||||||
|
|||||||
Reference in New Issue
Block a user