]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Fix incorrect address generation for altcoins with bip38
authorwoodser <woodser@protonmail.com>
Fri, 18 May 2018 14:26:54 +0000 (10:26 -0400)
committerwoodser <woodser@protonmail.com>
Fri, 18 May 2018 14:26:54 +0000 (10:26 -0400)
src/js/index.js

index 567a3f77afb6d2c757b4f5a851472b329cedb871..afa743dc924eb5cc35228e8b4f22c3093f085bb8 100644 (file)
                 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();
                 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) {