Return cached address while BWS returns main address GAP reached
This commit is contained in:
parent
fa4fd457a0
commit
fac553eb14
2 changed files with 7 additions and 23 deletions
|
|
@ -51,10 +51,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
|
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
|
||||||
$scope.generatingAddress = false;
|
$scope.generatingAddress = false;
|
||||||
if (err || lodash.isEmpty(addr)) {
|
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err || gettextCatalog.getString('Address is empty'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.addr = addr;
|
$scope.addr = addr;
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -791,29 +791,16 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
|
|
||||||
root.getAddress = function(wallet, forceNew, cb) {
|
root.getAddress = function(wallet, forceNew, cb) {
|
||||||
|
|
||||||
var firstStep;
|
storageService.getLastAddress(wallet.id, function(err, addr) {
|
||||||
if (forceNew) {
|
|
||||||
firstStep = storageService.clearLastAddress;
|
|
||||||
} else {
|
|
||||||
firstStep = function(walletId, cb) {
|
|
||||||
return cb();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
firstStep(wallet.id, function(err) {
|
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
storageService.getLastAddress(wallet.id, function(err, addr) {
|
if (!forceNew && addr) return cb(null, addr);
|
||||||
if (err) return cb(err);
|
|
||||||
|
|
||||||
if (addr) return cb(null, addr);
|
createAddress(wallet, function(err, _addr) {
|
||||||
|
if (err) return cb(err, addr);
|
||||||
createAddress(wallet, function(err, addr) {
|
storageService.storeLastAddress(wallet.id, _addr, function() {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
storageService.storeLastAddress(wallet.id, addr, function() {
|
return cb(null, _addr);
|
||||||
if (err) return cb(err);
|
|
||||||
return cb(null, addr);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue