diff options
author | woodser <woodser@protonmail.com> | 2018-05-18 10:26:54 -0400 |
---|---|---|
committer | woodser <woodser@protonmail.com> | 2018-05-18 10:26:54 -0400 |
commit | 29c30bf33ae079c55007d8738d077d10d40bca2b (patch) | |
tree | 3f0e03a33fdf30c3cbbb285eb2ec5af4e16ff4b9 /src | |
parent | 35d9e9fddc6b49b9250777e2901652218a270919 (diff) | |
download | BIP39-29c30bf33ae079c55007d8738d077d10d40bca2b.tar.gz BIP39-29c30bf33ae079c55007d8738d077d10d40bca2b.tar.zst BIP39-29c30bf33ae079c55007d8738d077d10d40bca2b.zip |
Fix incorrect address generation for altcoins with bip38
Diffstat (limited to 'src')
-rw-r--r-- | src/js/index.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/js/index.js b/src/js/index.js index 567a3f7..afa743d 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -813,7 +813,7 @@ | |||
813 | var keyPair = key.keyPair; | 813 | var keyPair = key.keyPair; |
814 | var useUncompressed = useBip38; | 814 | var useUncompressed = useBip38; |
815 | if (useUncompressed) { | 815 | if (useUncompressed) { |
816 | keyPair = new bitcoinjs.bitcoin.ECPair(keyPair.d, null, { compressed: false }); | 816 | keyPair = new bitcoinjs.bitcoin.ECPair(keyPair.d, null, { network: network, compressed: false }); |
817 | } | 817 | } |
818 | // get address | 818 | // get address |
819 | var address = keyPair.getAddress().toString(); | 819 | var address = keyPair.getAddress().toString(); |
@@ -821,7 +821,7 @@ | |||
821 | var hasPrivkey = !key.isNeutered(); | 821 | var hasPrivkey = !key.isNeutered(); |
822 | var privkey = "NA"; | 822 | var privkey = "NA"; |
823 | if (hasPrivkey) { | 823 | if (hasPrivkey) { |
824 | privkey = keyPair.toWIF(network); | 824 | privkey = keyPair.toWIF(); |
825 | // BIP38 encode private key if required | 825 | // BIP38 encode private key if required |
826 | if (useBip38) { | 826 | if (useBip38) { |
827 | privkey = bitcoinjsBip38.encrypt(keyPair.d.toBuffer(), false, bip38password, function(p) { | 827 | privkey = bitcoinjsBip38.encrypt(keyPair.d.toBuffer(), false, bip38password, function(p) { |