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:
Matias Alejo Garcia 2016-04-29 12:14:09 -03:00 committed by Gustavo Maximiliano Cortez
parent 8ffb01a355
commit 8b61189f85
11 changed files with 82 additions and 49 deletions

View File

@ -56,16 +56,16 @@ ios-debug:
open cordova/project/platforms/ios/Copay.xcodeproj
android-prod:
cordova/build.sh ANDROID --clear
cordova/build.sh ANDROID --clear
cd cordova/project && cordova build android --release
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play
../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk
android-debug:
cordova/build.sh ANDROID --dbgjs --clear
cordova/build.sh ANDROID --dbgjs
cd cordova/project && cordova run android
android-debug-fast:
cordova/build.sh ANDROID --dbgjs
cd cordova/project && cordova run android
cd cordova/project && cordova run android --device

View File

@ -1,8 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.bitpay.copay"
version="1.11.0"
android-versionCode="81"
ios-CFBundleVersion="1.11.0">
version="1.11.6"
android-versionCode="88"
ios-CFBundleVersion="1.11.6">
<name>Copay</name>
<description>
A secure bitcoin wallet for friends and companies.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="18C7659D.CopayWallet" Publisher="CN=F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" Version="1.11.0.0" />
<Identity Name="18C7659D.CopayWallet" Publisher="CN=F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" Version="1.11.6.0" />
<mp:PhoneIdentity PhoneProductId="5381aa50-9069-11e4-84cc-293caf9cbdc8" PhonePublisherId="F89609D1-EB3E-45FD-A58A-C2E3895FCE7B" />
<Properties>
<DisplayName>Copay Bitcoin Wallet</DisplayName>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Deployment AppPlatformVersion="8.1" xmlns="http://schemas.microsoft.com/windowsphone/2014/deployment">
<DefaultLanguage code="en-US" xmlns="" />
<Languages xmlns="">
@ -11,7 +11,7 @@
<Language code="pl" />
<Language code="cs" />
</Languages>
<App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.11.0.0" xmlns="" NotificationService="MPN">
<App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.11.6.0" xmlns="" NotificationService="MPN">
<IconPath IsRelative="true" IsResource="false">Assets\icon@2.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

View File

@ -2,8 +2,8 @@
"name": "copay",
"description": "A multisignature wallet",
"author": "BitPay",
"version": "1.11.0",
"androidVersionCode": "81",
"version": "1.11.6",
"androidVersionCode": "88",
"keywords": [
"wallet",
"copay",

View File

@ -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;
}

View File

@ -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();
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');
});
}
});
return;
}
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');
});
});
});
});
};

View File

@ -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) {

View File

@ -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);

View File

@ -1,6 +1,6 @@
[Desktop Entry]
Type=Application
Version=1.11.0
Version=1.11.6
Name=Copay
Comment=A multisignature wallet
Exec=copay

View File

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Copay"
#define MyAppVersion "1.11.0"
#define MyAppVersion "1.11.6"
#define MyAppPublisher "BitPay"
#define MyAppURL "https://copay.io"
#define MyAppExeName "Copay.exe"