Improve performance a little bit
This commit is contained in:
parent
a665b12a50
commit
075e445fef
2 changed files with 9 additions and 9 deletions
|
@ -103,9 +103,7 @@ new Vue({
|
||||||
for (let w = this.workers.length; w < this.threads; w++) {
|
for (let w = this.workers.length; w < this.threads; w++) {
|
||||||
try {
|
try {
|
||||||
this.workers[w] = new Worker('js/bundle.js');
|
this.workers[w] = new Worker('js/bundle.js');
|
||||||
this.workers[w].onmessage = function (event) {
|
this.workers[w].onmessage = event => self.parseWorkerMessage(event.data);
|
||||||
self.parseWorkerMessage(event.data, w);
|
|
||||||
};
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error = 'local_workers_forbidden';
|
this.error = 'local_workers_forbidden';
|
||||||
break;
|
break;
|
||||||
|
@ -113,7 +111,7 @@ new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
parseWorkerMessage: function (wallet, w) {
|
parseWorkerMessage: function (wallet) {
|
||||||
if (wallet.error) {
|
if (wallet.error) {
|
||||||
this.stopGen();
|
this.stopGen();
|
||||||
this.error = wallet.error;
|
this.error = wallet.error;
|
||||||
|
@ -127,8 +125,6 @@ new Vue({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.incrementCounter(wallet.attempts);
|
this.incrementCounter(wallet.attempts);
|
||||||
|
|
||||||
this.workers[w].postMessage(this.input);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startGen: function () {
|
startGen: function () {
|
||||||
|
|
10
js/vanity.js
10
js/vanity.js
|
@ -25,10 +25,14 @@ const getRandomWallet = () => {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
const isValidVanityWallet = (wallet, input, isChecksum) => {
|
const isValidVanityWallet = (wallet, input, isChecksum) => {
|
||||||
if (!isChecksum) {
|
if (input !== wallet.address.substr(2, input.length)) {
|
||||||
return wallet.address.substr(2, input.length) === input;
|
return false;
|
||||||
}
|
}
|
||||||
const address = ethUtils.stripHexPrefix(wallet.address).toLowerCase();
|
if (!isChecksum) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const address = wallet.address.substr(2);
|
||||||
const hash = ethUtils.sha3(address).toString('hex');
|
const hash = ethUtils.sha3(address).toString('hex');
|
||||||
|
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue