|
- You
-
- {{peer}}
+ You
+ {{peer}}
@@ -492,6 +491,7 @@
+
diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js
index af3404056..fed674948 100644
--- a/js/controllers/transactions.js
+++ b/js/controllers/transactions.js
@@ -60,7 +60,7 @@ angular.module('copay.transactions').controller('TransactionsController',
return;
}
var p = w.txProposals.getTxProposal(ntxid);
- if (p.txp.builder.isFullySigned()) {
+ if (p.builder.isFullySigned()) {
$scope.send(ntxid);
_updateTxs();
$rootScope.$digest();
diff --git a/js/models/core/PrivateKey.js b/js/models/core/PrivateKey.js
index 589dfaae0..6fdc21a44 100644
--- a/js/models/core/PrivateKey.js
+++ b/js/models/core/PrivateKey.js
@@ -18,13 +18,22 @@ function PrivateKey(opts) {
this.privateKeyCache = opts.privateKeyCache || {};
};
-PrivateKey.prototype.getId = function(prefix) {
- var buf = this.bip.extendedPublicKey;
- if (prefix) {
- buf = Buffer.concat([prefix, buf]);
+PrivateKey.prototype.getId = function() {
+ if (!this.id) {
+ var path = PublicKeyRing.SIGNING_BRANCH;
+ var bip32 = this.bip.derive(path);
+ this.id= bip32.eckey.public.toString('hex');
}
- var hash = util.sha256(buf).toString('hex');
- return hash.substring(0, hash.length/2);
+ return this.id;
+};
+
+PrivateKey.prototype.getSigningKey = function() {
+ if (!this.sid) {
+ var path = PublicKeyRing.SIGNING_BRANCH;
+ var bip32 = this.bip.derive(path);
+ this.sid= bip32.eckey.private.toString('hex');
+ }
+ return this.sid;
};
PrivateKey.fromObj = function(obj) {
diff --git a/js/models/core/PublicKeyRing.js b/js/models/core/PublicKeyRing.js
index a9a1327d5..6d757671f 100644
--- a/js/models/core/PublicKeyRing.js
+++ b/js/models/core/PublicKeyRing.js
@@ -44,9 +44,12 @@ function PublicKeyRing(opts) {
*/
PublicKeyRing.Branch = function (index, isChange) {
- return 'm/'+(isChange?1:0)+'/'+index;
+ // first 0 is for future use: could be copayerId.
+ return 'm/0/'+(isChange?1:0)+'/'+index;
};
+PublicKeyRing.SIGNING_BRANCH = 'm/100/0/0';
+
PublicKeyRing.fromObj = function (data) {
if (data instanceof PublicKeyRing) {
throw new Error('bad data format: Did you use .toObj()?');
@@ -77,17 +80,20 @@ PublicKeyRing.prototype.serialize = function () {
return JSON.stringify(this.toObj());
};
-PublicKeyRing.prototype.getCopayerId = function(i, prefix) {
- var buf = this.copayersBIP32[i].extendedPublicKey;
- if (prefix) {
- buf = Buffer.concat([prefix, buf]);
+PublicKeyRing.prototype.getCopayerId = function(i) {
+ this.copayerIds = this.copayerIds || [];
+
+ if (!this.copayerIds[i]) {
+ var path = PublicKeyRing.SIGNING_BRANCH;
+ var bip32 = this.copayersBIP32[i].derive(path);
+ this.copayerIds[i]= bip32.eckey.public.toString('hex');
}
- var hash = util.sha256(buf).toString('hex');
- return hash.substring(0, hash.length/2);
+
+ return this.copayerIds[i];
};
-PublicKeyRing.prototype.myCopayerId = function(i, prefix) {
- return this.getCopayerId(0,prefix);
+PublicKeyRing.prototype.myCopayerId = function(i) {
+ return this.getCopayerId(0);
};
PublicKeyRing.prototype.registeredCopayers = function () {
diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js
index 0e1d12348..fdbfe36ee 100644
--- a/js/models/core/Wallet.js
+++ b/js/models/core/Wallet.js
@@ -169,9 +169,10 @@ Wallet.prototype.netStart = function() {
var myId = self.getMyCopayerId();
var startOpts = {
- copayerId: myId
+ copayerId: myId,
+ signingKeyHex: self.privateKey.getSigningKey(),
};
- net.start(function() {
+ net.start(startOpts, function() {
self.emit('created');
for (var i=0; i |