From 335c3f00afb034e01b69852481f1c36c3d4db17d Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 20 May 2016 10:02:44 -0300 Subject: [PATCH] handles incorrect Address derivation (#4230) --- public/views/walletHome.html | 9 +++++++++ src/js/controllers/index.js | 1 + src/js/services/profileService.js | 11 ++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 721025c0b..021edbb5e 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -115,6 +115,15 @@ +
+
+ + + WARNING: Key derivation is not working on this device/wallet. Actions cannot be performed on this wallet. + +
+ +
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 177aa4a21..66e543410 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -136,6 +136,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted(); self.externalSource = fc.getPrivKeyExternalSourceName(); self.account = fc.credentials.account; + self.incorrectDerivation = fc.incorrectDerivation; if (self.externalSource == 'trezor') self.account++; diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index a9a07da19..c7463da2b 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -75,9 +75,14 @@ angular.module('copayApp.services') var client = bwcService.getClient(JSON.stringify(credentials)); root.walletClients[credentials.walletId] = client; + + if (client.incorrectDerivation) { + storageService.clearLastAddress(credentials.walletId,function() {}); + } + client.removeAllListeners(); client.on('report', function(n) { - $log.info('BWC Report:'+ n); + $log.info('BWC Report:' + n); }); client.on('notification', function(n) { @@ -319,8 +324,8 @@ angular.module('copayApp.services') // check if exist if (lodash.find(root.profile.credentials, { - 'walletId': walletData.walletId - })) { + 'walletId': walletData.walletId + })) { return cb(gettext('Cannot join the same wallet more that once')); } } catch (ex) {