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

@ -82,6 +82,7 @@ angular.module('copayApp.controllers').controller('importController',
};
var _importExtendedPrivateKey = function(xPrivKey, opts) {
console.log('[import.js.84:xPrivKey:]',xPrivKey); //TODO
self.loading = true;
$timeout(function() {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService, storageService, go) {
function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService, storageService, go, bitcore) {
var base = 'xpub';
var fc = profileService.focusedClient;
var c = fc.credentials;
@ -20,6 +20,20 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
$scope.addrs = null;
if (isMobile.Android()) {
$scope.androidTest = 'testing';
var xp = bitcore.HDPrivateKey("tprv8ZgxMBicQKsPebv8CVghFoaaZ6ejmcSmSaKo99sUnswCCPeccGbLzfoksA2wd5XdHe8UHLwM2emuBWD4cBvQ7BPTJhFu75u3HcSjRVFmYM9");
var pub = xp.derive("m/44'/1'/0'").hdPublicKey.toString();
if (pub == 'tpubDCe5stHkJZhfNMpQLgqRVYjSfADoosJ7FvxukgyXf1YzrCnru2z61giPXbgJGGxnHt922CY22DDDYD6d28jnd9okctoXNW837TmbNaAEM99') {
$scope.androidTest = 'OK, TEST PASSED';
} else {
$scope.androidTest = 'FAILED!! Please report to matias@bitpay.com. Result:' + pub;
}
}
fc.getMainAddresses({
doNotVerify: true
}, function(err, addrs) {

View file

@ -439,6 +439,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess(gettextCatalog.getString('Rejecting payment'));
$scope.loading = true;
$scope.error = null;
// TODO: This should be in txService
$timeout(function() {
fc.rejectTxProposal(txp, null, function(err, txpr) {
self.setOngoingProcess();
@ -982,7 +984,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess();
if (err) {
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
self.error = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be completed. Please try again from home screen'));
$scope.$emit('Local/TxProposalAction');
$timeout(function() {
$scope.$digest();

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')