This commit is contained in:
Matias Alejo Garcia 2014-09-15 14:25:09 -03:00
commit 64072f83bc

View file

@ -53,7 +53,6 @@ function WalletFactory(config, version, pluginManager) {
this.storage = new this.Storage(storageOpts); this.storage = new this.Storage(storageOpts);
<<<<<<< HEAD
this.networks = { this.networks = {
'livenet': new this.Network(config.network.livenet), 'livenet': new this.Network(config.network.livenet),
'testnet': new this.Network(config.network.testnet), 'testnet': new this.Network(config.network.testnet),
@ -63,11 +62,7 @@ function WalletFactory(config, version, pluginManager) {
'testnet': new this.Blockchain(config.network.testnet), 'testnet': new this.Blockchain(config.network.testnet),
}; };
this.walletDefaults = config.wallet; this.walletDefaults = config.walle || {};
=======
this.networkName = config.networkName;
this.walletDefaults = config.wallet || {};
>>>>>>> ALL TEST PASSING!!!
this.version = version; this.version = version;
}; };
@ -100,7 +95,7 @@ WalletFactory.prototype.fromObj = function(obj, skipFields) {
obj.opts.reconnectDelay = this.walletDefaults.reconnectDelay; obj.opts.reconnectDelay = this.walletDefaults.reconnectDelay;
// this is only used if private key or public key ring is skipped // this is only used if private key or public key ring is skipped
obj.opts.networkName = this.networkName; obj.opts.networkName = networkName;
skipFields = skipFields || []; skipFields = skipFields || [];
skipFields.forEach(function(k) { skipFields.forEach(function(k) {
@ -420,29 +415,28 @@ WalletFactory.prototype.joinCreateSession = function(opts, cb) {
}); });
joinNetwork.start(opts, function() { joinNetwork.start(opts, function() {
joinNetwork.greet(decodedSecret.pubKey, opts.secretNumber); joinNetwork.greet(decodedSecret.pubKey, opts.secretNumber);
joinNetwork.on('data', function(sender, data) { joinNetwork.on('data', function(sender, data) {
if (data.type === 'walletId' && data.opts) { if (data.type === 'walletId' && data.opts) {
if (data.networkName !== decodedSecret.networkName) { if (data.networkName !== decodedSecret.networkName) {
return cb('badNetwork'); return cb('badNetwork');
} }
data.opts.privateKey = privateKey; data.opts.privateKey = privateKey;
data.opts.nickname = nickname; data.opts.nickname = nickname;
data.opts.passphrase = passphrase; data.opts.passphrase = passphrase;
data.opts.id = data.walletId; data.opts.id = data.walletId;
self.create(data.opts, function(err, w) { self.create(data.opts, function(err, w) {
if (!err & w) { if (!err & w) {
w.sendWalletReady(s.pubKey); w.sendWalletReady(s.pubKey);
} else { } else {
if (!err) err = 'walletFull'; if (!err) err = 'walletFull';
} }
return cb(err, w); return cb(err, w);
}); });
}
}); });
}); });
};
}; };
module.exports = WalletFactory; module.exports = WalletFactory;