Fix next address

This commit is contained in:
Gustavo Maximiliano Cortez 2016-11-14 12:31:38 -03:00
commit 7e9d47c8e9
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 23 additions and 14 deletions

View file

@ -800,17 +800,20 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
root.getAddress = function(wallet, forceNew, cb) {
storageService.getLastAddress(wallet.id, function(err, addr) {
if (err) return cb(err);
if (!forceNew && addr) return cb(null, addr);
createAddress(wallet, function(err, _addr) {
if (err) return cb(err, addr);
storageService.storeLastAddress(wallet.id, _addr, function() {
if (err) return cb(err);
return cb(null, _addr);
root.isReady(wallet, function(err) {
if (err) return cb(err);
createAddress(wallet, function(err, _addr) {
if (err) return cb(err, addr);
storageService.storeLastAddress(wallet.id, _addr, function() {
if (err) return cb(err);
return cb(null, _addr);
});
});
});
});