Show GAP error and returns the latest address

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-29 17:09:21 -03:00
parent bc9d4bd994
commit 02eb9561b7
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 5 additions and 5 deletions

View File

@ -56,7 +56,7 @@
"bezier-easing": "^2.0.3",
"bhttp": "^1.2.1",
"bitauth": "^0.2.1",
"bitcore-wallet-client": "5.2.0",
"bitcore-wallet-client": "5.2.1",
"bower": "^1.7.9",
"cordova-android": "5.1.1",
"cordova-custom-config": "^3.0.5",

View File

@ -836,13 +836,13 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.createAddress({}, function(err, addr) {
if (err) {
var prefix = gettextCatalog.getString('Could not create address');
if (err.error && err.error.match(/locked/gi)) {
$log.debug(err.error);
if (err instanceof errors.CONNECTION_ERROR || (err.message && err.message.match(/5../))) {
$log.warn(err);
return $timeout(function() {
createAddress(wallet, cb);
}, 5000);
} else if (err.message && err.message == 'MAIN_ADDRESS_GAP_REACHED') {
$log.warn(err.message);
} else if (err instanceof errors.MAIN_ADDRESS_GAP_REACHED || (err.message && err.message == 'MAIN_ADDRESS_GAP_REACHED')) {
$log.warn(err);
prefix = null;
wallet.getMainAddresses({
reverse: true,