fix join sync

This commit is contained in:
Matias Alejo Garcia 2014-12-02 17:32:32 -03:00
commit 8d7783cac3
4 changed files with 25 additions and 16 deletions

View file

@ -474,6 +474,8 @@ Identity.importFromFullJson = function(str, password, opts, cb) {
* @emits newWallet (walletId)
*/
Identity.prototype.bindWallet = function(w) {
preconditions.checkArgument(w && this.wallets[w.getId()]);
var self = this;
log.debug('Binding wallet:' + w.getName());
@ -571,13 +573,10 @@ Identity.prototype.createWallet = function(opts, cb) {
opts.version = opts.version || this.version;
var self = this;
var w = new walletClass(opts);
self.wallets[w.getId()] = w;
self.updateFocusedTimestamp(w.getId());
self.bindWallet(w);
self.updateFocusedTimestamp(w.getId());
self.storeWallet(w, function(err) {
if (err) return cb(err);