To debug sign procedure (#4151)
* Should be considering the existence of a property and not its value. (#4139) * BETA to debug sign test on Android * add more logs * 1.11.4 * and even more logs... * 1.11.5 * better log messages * fix log decorator for mobile * fix android-prod * 1.11.6
This commit is contained in:
parent
8ffb01a355
commit
8b61189f85
11 changed files with 82 additions and 49 deletions
|
|
@ -97,7 +97,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.loadingWallet = true;
|
||||
return;
|
||||
}
|
||||
if (vanillaScope[k]) {
|
||||
if (!lodash.isUndefined(vanillaScope[k])) {
|
||||
self[k] = vanillaScope[k];
|
||||
return;
|
||||
}
|
||||
|
|
@ -1350,9 +1350,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
coinbaseService.getPendingTransactions(function(err, txs) {
|
||||
self.coinbasePendingTransactions = lodash.isEmpty(txs) ? null : txs;
|
||||
lodash.forEach(txs, function(dataFromStorage, txId) {
|
||||
if ((dataFromStorage.type == 'sell' && dataFromStorage.status == 'completed') ||
|
||||
if ((dataFromStorage.type == 'sell' && dataFromStorage.status == 'completed') ||
|
||||
(dataFromStorage.type == 'buy' && dataFromStorage.status == 'completed') ||
|
||||
dataFromStorage.status == 'error' ||
|
||||
dataFromStorage.status == 'error' ||
|
||||
(dataFromStorage.type == 'send' && dataFromStorage.status == 'completed')) return;
|
||||
coinbaseService.getTransaction(accessToken, accountId, txId, function(err, tx) {
|
||||
if (err) {
|
||||
|
|
@ -1453,7 +1453,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
if (err) $log.debug(err);
|
||||
});
|
||||
} else {
|
||||
if (!res.data.id) {
|
||||
if (!res.data.id) {
|
||||
coinbaseService.savePendingTransaction(tx, {status: 'error', error: err}, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
|
|
@ -1492,7 +1492,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
return;
|
||||
}
|
||||
coinbaseService.savePendingTransaction(tx, {remove: true}, function(err) {
|
||||
coinbaseService.savePendingTransaction(tx, {remove: true}, function(err) {
|
||||
coinbaseService.getTransaction(self.coinbaseToken, self.coinbaseAccount.id, res.data.transaction.id, function(err, updatedTx) {
|
||||
coinbaseService.savePendingTransaction(updatedTx.data, {}, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
|
|
@ -1503,7 +1503,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
self.setAddressbook = function(ab) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$log.debug('Cleaning WalletHome Instance');
|
||||
lodash.each(self, function(v, k) {
|
||||
if (lodash.isFunction(v)) return;
|
||||
if (vanillaScope[k]) {
|
||||
if (!lodash.isUndefined(vanillaScope[k])) {
|
||||
self[k] = vanillaScope[k];
|
||||
return;
|
||||
}
|
||||
|
|
@ -954,35 +954,48 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.confirmTx = function(txp) {
|
||||
var self = this;
|
||||
|
||||
$log.info('at .confirmTx');
|
||||
txService.prepare({}, function(err) {
|
||||
$log.info('after .prepare:', err);
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
$log.warn('confirmTx/Prepare error:', err);
|
||||
return self.setSendError(err);
|
||||
}
|
||||
self.setOngoingProcess(gettextCatalog.getString('Sending transaction'));
|
||||
txService.publishTx(txp, {}, function(err, txpPublished) {
|
||||
|
||||
$log.info('after .publishTx:', err);
|
||||
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
self.setSendError(err);
|
||||
} else {
|
||||
txService.signAndBroadcast(txpPublished, {
|
||||
reporterFn: self.setOngoingProcess.bind(self)
|
||||
}, function(err, txp) {
|
||||
self.resetForm();
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
|
||||
$scope.$emit('Local/TxProposalAction');
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
} else {
|
||||
go.walletHome();
|
||||
txStatus.notify(txp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
|
||||
});
|
||||
}
|
||||
txService.signAndBroadcast(txpPublished, {
|
||||
reporterFn: self.setOngoingProcess.bind(self)
|
||||
}, function(err, txp) {
|
||||
$log.info('after .signAndBroadcast:', err);
|
||||
self.resetForm();
|
||||
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');
|
||||
$scope.$emit('Local/TxProposalAction');
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
$log.info('Transaction status:', txp.status);
|
||||
go.walletHome();
|
||||
txStatus.notify(txp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ angular
|
|||
if (level == 'error')
|
||||
console.log(arguments);
|
||||
|
||||
var args = [].slice.call(arguments);
|
||||
if (!Array.isArray(args)) args = [args];
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
args = args.map(function(v) {
|
||||
try {
|
||||
if (typeof v == 'undefined') v = 'undefined';
|
||||
|
|
@ -47,8 +47,8 @@ angular
|
|||
// Trim output in mobile
|
||||
if (window.cordova) {
|
||||
v = v.toString();
|
||||
if (v.length > 300) {
|
||||
v = v.substr(0, 297) + '...';
|
||||
if (v.length > 3000) {
|
||||
v = v.substr(0, 2997) + '...';
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -57,9 +57,11 @@ angular
|
|||
}
|
||||
return v;
|
||||
});
|
||||
|
||||
try {
|
||||
if (window.cordova)
|
||||
console.log(args.join(' '));
|
||||
|
||||
historicLog.add(level, args.join(' '));
|
||||
orig.apply(null, args);
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
};
|
||||
|
||||
root.prepare = function(opts, cb) {
|
||||
$log.info("at .prepare");
|
||||
opts = opts || {};
|
||||
var fc = opts.selectedClient || profileService.focusedClient;
|
||||
if (!fc.canSign() && !fc.isPrivKeyExternal())
|
||||
|
|
@ -79,12 +80,14 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
|
||||
root.checkTouchId(opts, function(err) {
|
||||
if (err) {
|
||||
$log.warn('CheckTouchId error:', err);
|
||||
return cb(err);
|
||||
};
|
||||
|
||||
profileService.unlockFC(opts, function(err) {
|
||||
if (err) {
|
||||
return cb(bwsError.msg(err));
|
||||
$log.warn("prepare/unlockFC error:", err);
|
||||
return cb(err);
|
||||
};
|
||||
|
||||
return cb();
|
||||
|
|
@ -176,6 +179,7 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
};
|
||||
|
||||
root.sign = function(txp, opts, cb) {
|
||||
$log.info('at .sign');
|
||||
opts = opts || {};
|
||||
var fc = opts.selectedClient || profileService.focusedClient;
|
||||
|
||||
|
|
@ -191,14 +195,26 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
return cb(msg);
|
||||
}
|
||||
} else {
|
||||
fc.signTxProposal(txp, function(err, signedTxp) {
|
||||
profileService.lockFC();
|
||||
return cb(err, signedTxp);
|
||||
});
|
||||
|
||||
txp.signatures = null;
|
||||
$log.info('at .sign: (isEncrypted):', fc.isPrivKeyEncrypted());
|
||||
$log.info('txp BEFORE:', 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root.signAndBroadcast = function(txp, opts, cb) {
|
||||
$log.info('at .signAndBroadcast');
|
||||
opts = opts || {};
|
||||
reportSigningStatus(opts);
|
||||
|
||||
|
|
@ -234,12 +250,14 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
|
||||
root.prepareAndSignAndBroadcast = function(txp, opts, cb) {
|
||||
opts = opts || {};
|
||||
$log.info('at .prepareSignAndBroadcast');
|
||||
|
||||
root.prepare(opts, function(err) {
|
||||
if (err) {
|
||||
$log.warn('Prepare error:' + err);
|
||||
stopReport(opts);
|
||||
return cb(err);
|
||||
};
|
||||
reportSigningStatus(opts);
|
||||
root.signAndBroadcast(txp, opts, function(err, txp) {
|
||||
if (err) {
|
||||
stopReport(opts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue