add multiple optiomizations for 30+ tx wallets

This commit is contained in:
Matias Alejo Garcia 2014-05-17 01:19:52 -03:00
commit ba5a3ac2c6
8 changed files with 121 additions and 70 deletions

View file

@ -54,7 +54,11 @@ Wallet.prototype.seedCopayer = function(pubKey) {
};
Wallet.prototype.connectToAll = function() {
console.log('[Wallet.js.57]'); //TODO
var all = this.publicKeyRing.getAllCopayerIds();
console.log('[Wallet.js.58] connecting'); //TODO
this.network.connectToCopayers(all);
if (this.seededCopayerId) {
this.sendWalletReady(this.seededCopayerId);
@ -106,7 +110,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
this.sendTxProposals(recipients, newId);
}
if (data.lastInBatch) {
this.emit('txProposalsUpdated', this.txProposals);
this.emit('txProposalsUpdated');
this.store();
}
};
@ -225,10 +229,11 @@ Wallet.prototype.netStart = function() {
net.start(startOpts, function() {
self.emit('ready', net.getPeer());
setTimeout(function(){
console.log('[EMIT publicKeyRingUpdated:]'); //TODO
self.emit('publicKeyRingUpdated');
console.log('[CONNECT:]'); //TODO
console.log('[EMIT publicKeyRingUpdated:]'); //TODO
self.emit('publicKeyRingUpdated', true);
console.log('[CONNECT:]'); //TODO
self.connectToAll();
console.log('[EMIT TxProposal]'); //TODO
self.emit('txProposalsUpdated');
},10);
});

View file

@ -48,9 +48,9 @@ WalletFactory.prototype._checkRead = function(walletId) {
};
WalletFactory.prototype.fromObj = function(obj) {
console.log('## Decrypting'); //TODO
var w = Wallet.fromObj(obj, this.storage, this.network, this.blockchain);
w.verbose = this.verbose;
// JIC: Add our key
try {
w.publicKeyRing.addCopayer(
@ -60,16 +60,15 @@ WalletFactory.prototype.fromObj = function(obj) {
// No really an error, just to be sure.
}
this.log('### WALLET OPENED:', w.id);
// store imported wallet
w.store();
return w;
};
WalletFactory.prototype.fromEncryptedObj = function(base64, password) {
this.storage._setPassphrase(password);
var walletObj = this.storage.import(base64);
return this.fromObj(walletObj);
var w= this.fromObj(walletObj);
w.store();
return w;
};
WalletFactory.prototype.read = function(walletId) {