add indexes to copayer
This commit is contained in:
parent
d6733de12d
commit
7b68c14fb7
|
@ -24,6 +24,24 @@ Copayer.prototype.getSigningPubKey = function () {
|
|||
return HDPublicKey.fromString(this.xPubKey).derive(MESSAGE_SIGNING_PATH).publicKey.toString();
|
||||
};
|
||||
|
||||
Copayer.prototype.addAddress = function (isChange) {
|
||||
if (isChange) {
|
||||
this.changeAddressIndex++;
|
||||
} else {
|
||||
this.receiveAddressIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Copayer.prototype.getCurrentAddressPath = function (isChange) {
|
||||
return
|
||||
};
|
||||
|
||||
Copayer.prototype.getNewAddressPath = function (isChange) {
|
||||
this.addAddress(isChange);
|
||||
return this.currentAddressPath(isChange);
|
||||
};
|
||||
|
||||
Copayer.fromObj = function (obj) {
|
||||
var x = new Copayer();
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ CopayServer.prototype._verifySignature = function (text, signature, pubKey) {
|
|||
name: opts.name,
|
||||
xPubKey: opts.xPubKey,
|
||||
xPubKeySignature: opts.xPubKeySignature,
|
||||
copayerIndex: wallet.copayers.length,
|
||||
});
|
||||
|
||||
wallet.addCopayer(copayer);
|
||||
|
|
|
@ -471,6 +471,9 @@ describe('Copay server', function() {
|
|||
should.not.exist(err);
|
||||
wallet.status.should.equal('complete');
|
||||
wallet.publicKeyRing.length.should.equal(3);
|
||||
_.each([0,1,2], function(i) {
|
||||
wallet.copayers[i].copayerIndex.should.equal(i);
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue