fix logs in txservice, add logs to bwc (#4164)

* fix logs in txservice, add logs to bwc

* 1.12.8 + add test for android

* new version 1.12.11

* revert changes in index
This commit is contained in:
Matias Alejo Garcia 2016-05-03 10:42:18 -03:00 committed by Gustavo Maximiliano Cortez
commit e7f1bbba7d
16 changed files with 70 additions and 39 deletions

View file

@ -76,6 +76,9 @@ angular.module('copayApp.services')
var client = bwcService.getClient(JSON.stringify(credentials));
root.walletClients[credentials.walletId] = client;
client.removeAllListeners();
client.on('report', function(n) {
$log.info('BWC Report:'+ n);
});
client.on('notification', function(n) {
$log.debug('BWC Notification:', n);
@ -118,6 +121,7 @@ angular.module('copayApp.services')
root.setWalletClients = function() {
var credentials = root.profile.credentials;
lodash.each(credentials, function(credential) {
//$log.info("Credentials:", credentials);
root.setWalletClient(credential);
});
$rootScope.$emit('Local/WalletListUpdated');
@ -673,18 +677,18 @@ angular.module('copayApp.services')
$log.debug('Wallet is encrypted');
$rootScope.$emit('Local/NeedsPassword', false, function(err2, password) {
if (err2 || !password) {
return cb({
message: (err2 || gettext('Password needed'))
});
}
if (err2)
return cb(err2);
if (!password)
return cb(gettext('Password needed'));
try {
fc.unlock(password);
} catch (e) {
$log.debug(e);
return cb({
message: gettext('Wrong password')
});
$log.warn('Error decrypting wallet:', e);
return cb(gettext('Wrong password'));
}
return cb();
});

View file

@ -75,6 +75,7 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
$log.info("at .prepare");
opts = opts || {};
var fc = opts.selectedClient || profileService.focusedClient;
$log.info('FC Client Dump:' + fc);
if (!fc.canSign() && !fc.isPrivKeyExternal())
return cb('Cannot sign'); // should never happen, no need to translate
@ -198,18 +199,13 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
txp.signatures = null;
$log.info('at .sign: (isEncrypted):', fc.isPrivKeyEncrypted());
$log.info('txp BEFORE:', txp);
$log.info('txp BEFORE .signTxProposal:', txp);
try {
fc.signTxProposal(txp, function(err, signedTxp) {
$log.info('txp AFTER:',err, signedTxp);
profileService.lockFC();
return cb(err, signedTxp);
});
} catch (e) {
$log.warn('Error at signTxProposal:', e);
return cb(e);
}
fc.signTxProposal(txp, function(err, signedTxp) {
$log.info('txp AFTER .signTxProposal:',err, signedTxp);
profileService.lockFC();
return cb(err, signedTxp);
});
}
};
@ -222,7 +218,7 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
root.sign(txp, opts, function(err, txp) {
if (err) {
stopReport(opts);
return cb(bwsError.msg(err), gettextCatalog.getString('Could not accept payment'));
return bwsError.cb(err, gettextCatalog.getString('Could not accept payment'), cb);
};
if (txp.status != 'accepted') {
@ -235,7 +231,7 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
stopReport(opts);
if (err) {
return cb(bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment')));
return bwsError.cb(err, gettextCatalog.getString('Could not broadcast payment'), cb);
};
$log.debug('Transaction signed and broadcasted')