optimize PrivateKey with cache

This commit is contained in:
Manuel Araoz 2014-04-17 17:01:31 -03:00
commit 5847d6aff2
8 changed files with 109 additions and 50 deletions

View file

@ -43,7 +43,7 @@ var createPKR = function (bip32s) {
for(var i=0; i<5; i++) {
if (bip32s) {
var b=bip32s[i];
w.addCopayer(b?b.extendedPublicKeyString():null);
w.addCopayer(b?b.getExtendedPublicKeyString():null);
}
else
w.addCopayer();
@ -110,7 +110,7 @@ describe('TxProposals model', function() {
networkName: config.networkName,
});
var start = new Date().getTime();
var pkr=createPKR([priv.getBIP32()]);
var pkr=createPKR([priv]);
var ts = Date.now();
var isChange=0;
var index=0;
@ -150,7 +150,7 @@ describe('TxProposals model', function() {
var ts = Date.now();
var isChange=0;
var index=0;
var pkr = createPKR([priv.getBIP32()]);
var pkr = createPKR([priv]);
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
@ -225,7 +225,7 @@ var _dumpChunks = function (scriptSig, label) {
var ts = Date.now();
var isChange=0;
var index=0;
var pkr = createPKR([priv.getBIP32(), priv2.getBIP32()]);
var pkr = createPKR([priv, priv2]);
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
var w = new TxProposals({
@ -325,7 +325,7 @@ var _dumpChunks = function (scriptSig, label) {
var ts = Date.now();
var isChange=0;
var index=0;
var pkr = createPKR([priv.getBIP32(), priv2.getBIP32(), priv3.getBIP32() ]);
var pkr = createPKR([priv, priv2, priv3]);
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
var w = new TxProposals({
@ -416,7 +416,7 @@ var _dumpChunks = function (scriptSig, label) {
it('#toObj #fromObj roundtrip', function () {
var priv = new PrivateKey(config);
var pkr = createPKR([priv.getBIP32()]);
var pkr = createPKR([priv]);
var w = new TxProposals({
walletId: 'qwerty',
networkName: config.networkName,