|
|
@ -775,10 +775,6 @@ WalletService.prototype.createAddress = function(opts, cb) { |
|
|
|
opts = opts || {}; |
|
|
|
|
|
|
|
function createNewAddress(wallet, cb) { |
|
|
|
self._canCreateAddress(opts.ignoreMaxGap, function(err, canCreate) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!canCreate) return cb(Errors.MAIN_ADDRESS_GAP_REACHED); |
|
|
|
|
|
|
|
var address = wallet.createAddress(false); |
|
|
|
|
|
|
|
self.storage.storeAddressAndWallet(wallet, address, function(err) { |
|
|
@ -790,7 +786,6 @@ WalletService.prototype.createAddress = function(opts, cb) { |
|
|
|
return cb(null, address); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function getFirstAddress(wallet, cb) { |
|
|
@ -801,6 +796,10 @@ WalletService.prototype.createAddress = function(opts, cb) { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
self._canCreateAddress(opts.ignoreMaxGap, function(err, canCreate) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!canCreate) return cb(Errors.MAIN_ADDRESS_GAP_REACHED); |
|
|
|
|
|
|
|
self._runLocked(cb, function(cb) { |
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
|
if (err) return cb(err); |
|
|
@ -810,6 +809,7 @@ WalletService.prototype.createAddress = function(opts, cb) { |
|
|
|
return createFn(wallet, cb); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|