From e0993c90a6e78361a74b25a1d1942a2524a23f8d Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 9 Apr 2014 17:28:35 -0300 Subject: [PATCH] txproposal basic features and test --- js/models/PublicKeyRing.js | 45 +++++++++---- js/models/TxProposals.js | 77 ++++++++++++++++++++++ test/test.publickeyring.js | 18 ++++++ test/test.txproposal.js | 127 +++++++++++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+), 12 deletions(-) create mode 100644 js/models/TxProposals.js create mode 100644 test/test.txproposal.js diff --git a/js/models/PublicKeyRing.js b/js/models/PublicKeyRing.js index 42e6fa626..dba051db9 100644 --- a/js/models/PublicKeyRing.js +++ b/js/models/PublicKeyRing.js @@ -14,17 +14,6 @@ var buffertools = bitcore.buffertools; var Storage = imports.Storage || require('./Storage'); var storage = Storage.default(); -/* - * This follow Electrum convetion, as described in - * https://bitcointalk.org/index.php?topic=274182.0 - * - * We should probably adopt the next standard once it's ready, as discussed in: - * http://sourceforge.net/p/bitcoin/mailman/message/32148600/ - * - */ - -var PUBLIC_BRANCH = 'm/0/'; -var CHANGE_BRANCH = 'm/1/'; function PublicKeyRing(opts) { opts = opts || {}; @@ -44,6 +33,22 @@ function PublicKeyRing(opts) { this.addressIndex=0; } +/* + * This follow Electrum convetion, as described in + * https://bitcointalk.org/index.php?topic=274182.0 + * + * We should probably adopt the next standard once it's ready, as discussed in: + * http://sourceforge.net/p/bitcoin/mailman/message/32148600/ + * + */ + +PublicKeyRing.PublicBranch = function (index) { + return 'm/0/'+index; +}; + +PublicKeyRing.ChangeBranch = function (index) { + return 'm/1/'+index; +}; PublicKeyRing.getRandomId = function () { return buffertools.toHex(coinUtil.generateNonce()); @@ -177,7 +182,7 @@ PublicKeyRing.prototype.getPubKeys = function (index, isChange) { var pubKeys = []; var l = this.copayersBIP32.length; for(var i=0; i