add update on network events to txproposals

This commit is contained in:
Matias Alejo Garcia 2014-04-25 17:53:19 -03:00
parent 751d86e785
commit e46901c369
3 changed files with 16 additions and 2 deletions

View File

@ -6,6 +6,9 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.title = 'Transactions';
$scope.loading = false;
var _updateTxs = function() {
var w =$rootScope.wallet;
if (!w) return;
@ -99,4 +102,13 @@ angular.module('copay.transactions').controller('TransactionsController',
};
_updateTxs();
var w = $rootScope.wallet;
if (w) {
w.on('txProposalsUpdated', function() {
console.log('[transactions.js.108: txProposalsUpdated:]'); //TODO
_updateTxs();
$rootScope.$digest();
});
}
});

View File

@ -60,6 +60,7 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
this._lockIncomming();
}
}
this.emit('publicKeyRingUpdated', this.publicKeyRing);
this.store();
};
@ -76,6 +77,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
recipients = null;
this.sendTxProposals(recipients);
}
this.emit('txProposalsUpdated', this.txProposals);
this.store();
};
@ -242,7 +244,6 @@ Wallet.prototype.sendTxProposals = function(recipients) {
txProposals: this.txProposals.toObj(),
walletId: this.id,
});
this.emit('txProposalsUpdated', this.txProposals);
};
Wallet.prototype.sendWalletReady = function(recipients) {
@ -274,7 +275,6 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
publicKeyRing: this.publicKeyRing.toObj(),
walletId: this.id,
});
this.emit('publicKeyRingUpdated', this.publicKeyRing);
};

View File

@ -201,6 +201,8 @@ console.log('[WebRTC.js.161:payload:]',payload); //TODO
}
var copayerIdBuf = new Buffer(this.copayerForPeer[peerId],'hex');
console.log('[WebRTC.js.204] sig:', sig); //TODO
if (!bitcore.Message.verifyWithPubKey( copayerIdBuf, JSON.stringify(payload),
new Buffer(sig,'hex'))) {
console.log('[WebRTC.js.152] SIGNATURE VERIFICATION FAILED!!'); //TODO