compress vanity wallet output if any input is compressed
This commit is contained in:
parent
72aefc03e0
commit
f0a0260617
1 changed files with 9 additions and 1 deletions
|
@ -29,10 +29,17 @@ ninja.wallets.vanitywallet = {
|
|||
var privateKeyWif = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys");
|
||||
var bitcoinAddress = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys");
|
||||
var publicKeyHex = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys");
|
||||
var compressedOutput = false;
|
||||
try {
|
||||
var input1KeyString = document.getElementById("vanityinput1").value;
|
||||
var input2KeyString = document.getElementById("vanityinput2").value;
|
||||
|
||||
// if any input is in a compressed format, compress the output
|
||||
compressedOutput = compressedOutput || ninja.publicKey.isCompressedPublicKeyHexFormat(input1KeyString);
|
||||
compressedOutput = compressedOutput || ninja.publicKey.isCompressedPublicKeyHexFormat(input2KeyString);
|
||||
compressedOutput = compressedOutput || Bitcoin.ECKey.isCompressedWalletImportFormat(input1KeyString);
|
||||
compressedOutput = compressedOutput || Bitcoin.ECKey.isCompressedWalletImportFormat(input2KeyString);
|
||||
|
||||
// both inputs are public keys
|
||||
if (ninja.publicKey.isPublicKeyHexFormat(input1KeyString) && ninja.publicKey.isPublicKeyHexFormat(input2KeyString)) {
|
||||
// add both public keys together
|
||||
|
@ -88,6 +95,7 @@ ninja.wallets.vanitywallet = {
|
|||
alert(ninja.translator.get("vanityalertinvalidinputprivatekeysmatch"));
|
||||
}
|
||||
else {
|
||||
combinedPrivateKey.compressed = compressedOutput;
|
||||
bitcoinAddress = combinedPrivateKey.getBitcoinAddress();
|
||||
privateKeyWif = combinedPrivateKey.getBitcoinWalletImportFormat();
|
||||
publicKeyHex = combinedPrivateKey.getPubKeyHex();
|
||||
|
@ -115,4 +123,4 @@ ninja.wallets.vanitywallet = {
|
|||
document.getElementById("vanitystep" + num + "icon").setAttribute("class", "less");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue