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++) {
|
||||
try {
|
||||
this.workers[w] = new Worker('js/bundle.js');
|
||||
this.workers[w].onmessage = function (event) {
|
||||
self.parseWorkerMessage(event.data, w);
|
||||
};
|
||||
this.workers[w].onmessage = event => self.parseWorkerMessage(event.data);
|
||||
} catch (err) {
|
||||
this.error = 'local_workers_forbidden';
|
||||
break;
|
||||
|
@ -113,7 +111,7 @@ new Vue({
|
|||
}
|
||||
},
|
||||
|
||||
parseWorkerMessage: function (wallet, w) {
|
||||
parseWorkerMessage: function (wallet) {
|
||||
if (wallet.error) {
|
||||
this.stopGen();
|
||||
this.error = wallet.error;
|
||||
|
@ -127,8 +125,6 @@ new Vue({
|
|||
}
|
||||
|
||||
this.incrementCounter(wallet.attempts);
|
||||
|
||||
this.workers[w].postMessage(this.input);
|
||||
},
|
||||
|
||||
startGen: function () {
|
||||
|
|
10
js/vanity.js
10
js/vanity.js
|
@ -25,10 +25,14 @@ const getRandomWallet = () => {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
const isValidVanityWallet = (wallet, input, isChecksum) => {
|
||||
if (!isChecksum) {
|
||||
return wallet.address.substr(2, input.length) === input;
|
||||
if (input !== wallet.address.substr(2, input.length)) {
|
||||
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');
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue