fix skip Validation. Replaces scanning with updating

This commit is contained in:
Matias Alejo Garcia 2016-06-14 14:05:25 -03:00
commit 57aecf7e1b
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 11 additions and 9 deletions

View file

@ -286,7 +286,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else { } else {
self.isSingleAddress = !!ret.wallet.singleAddress; self.isSingleAddress = !!ret.wallet.singleAddress;
if (!opts.quiet) if (!opts.quiet)
ongoingProcess.set('scanning', ret.wallet.scanStatus == 'running'); self.updating = ret.wallet.scanStatus == 'running';
} }
return cb(err, ret); return cb(err, ret);
}); });
@ -1015,13 +1015,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!c.isComplete()) return; if (!c.isComplete()) return;
if (self.walletId == walletId) if (self.walletId == walletId)
ongoingProcess.set('scanning', true); self.updating = true;
c.startScan({ c.startScan({
includeCopayerBranches: true, includeCopayerBranches: true,
}, function(err) { }, function(err) {
if (err && self.walletId == walletId) { if (err && self.walletId == walletId) {
ongoingProcess.set('scanning', false); self.updating = false;
self.handleError(err); self.handleError(err);
$rootScope.$apply(); $rootScope.$apply();
} }

View file

@ -122,12 +122,13 @@ angular.module('copayApp.services')
$timeout(function() { $timeout(function() {
$log.debug('ValidatingWallet: ' + walletId + ' device validation:' + skipDeviceValidation); $log.debug('ValidatingWallet: ' + walletId + ' skip Device:' + skipDeviceValidation);
$rootScope.$emit('Local/ValidatingWallet', walletId); $rootScope.$emit('Local/ValidatingWallet', walletId);
client.validateKeyDerivation({ client.validateKeyDerivation({
skipDeviceValidation: skipDeviceValidation, skipDeviceValidation: skipDeviceValidation,
}, function(err, isOK) { }, function(err, isOK) {
$log.debug('ValidatingWallet End: ' + walletId + ' isOK:' + isOK);
$rootScope.$emit('Local/ValidatingWalletEnded', walletId, isOK); $rootScope.$emit('Local/ValidatingWalletEnded', walletId, isOK);
if (isOK) { if (isOK) {
@ -137,7 +138,7 @@ angular.module('copayApp.services')
storageService.clearLastAddress(walletId, function() {}); storageService.clearLastAddress(walletId, function() {});
} }
}); });
}, 10); }, 3000);
}; };
// Used when reading wallets from the profile // Used when reading wallets from the profile
@ -159,7 +160,6 @@ angular.module('copayApp.services')
}); });
var skipKeyValidation = root.profile.isChecked(platformInfo.ua, credentials.walletId); var skipKeyValidation = root.profile.isChecked(platformInfo.ua, credentials.walletId);
if (!skipKeyValidation) if (!skipKeyValidation)
root.runValidation(client); root.runValidation(client);
@ -477,6 +477,11 @@ angular.module('copayApp.services')
if (!root.profile.addWallet(JSON.parse(client.export()))) if (!root.profile.addWallet(JSON.parse(client.export())))
return cb(gettext('Wallet already in Copay')); return cb(gettext('Wallet already in Copay'));
var skipKeyValidation = root.profile.isChecked(platformInfo.ua, walletId);
if (!skipKeyValidation)
root.runValidation(client);
root.bindWalletClient(client); root.bindWalletClient(client);
$rootScope.$emit('Local/WalletListUpdated', client); $rootScope.$emit('Local/WalletListUpdated', client);
@ -557,9 +562,6 @@ angular.module('copayApp.services')
var addressBook = str.addressBook || {}; var addressBook = str.addressBook || {};
var historyCache = str.historyCache ||  []; var historyCache = str.historyCache ||  [];
if (!walletClient.incorrectDerivation)
root.profile.setChecked(platformInfo.ua, walletClient.credentials.walletId);
root.addAndBindWalletClient(walletClient, { root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl, bwsurl: opts.bwsurl,
isImport: true isImport: true