diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-15 23:12:19 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-16 04:43:17 +0100 |
commit | ad679a4d0e555a7ede1eac95f79105a35e45b311 (patch) | |
tree | 6d7b1d3d700b0b896311ae8fe961eb3e16af29be /extension | |
parent | f588e1a60e8f0208b9d2dbbfcb3ba5abb3755273 (diff) | |
download | wallet-core-ad679a4d0e555a7ede1eac95f79105a35e45b311.tar.xz |
Correct types / memory leak.
Diffstat (limited to 'extension')
-rw-r--r-- | extension/background/wallet.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/extension/background/wallet.js b/extension/background/wallet.js index 73d30c0d2..dd1bccaea 100644 --- a/extension/background/wallet.js +++ b/extension/background/wallet.js @@ -14,13 +14,13 @@ function openTalerDb() { reject(e); }; req.onsuccess = (e) => { - resolve(e.target.result); + resolve(req.result); }; - req.onupgradeneeded = (event) => { - let db = event.target.result; - console.log("DB: upgrade needed: oldVersion = " + event.oldVersion); - db = event.target.result; - switch (event.oldVersion) { + req.onupgradeneeded = (e) => { + let db = e.target.result; + console.log("DB: upgrade needed: oldVersion = " + e.oldVersion); + db = e.target.result; + switch (e.oldVersion) { case 0: db.createObjectStore("mints", { keyPath: "baseUrl" }); db.createObjectStore("reserves", { keyPath: "reserve_pub" }); @@ -127,7 +127,7 @@ function withdraw(denom, reserve, mint) { let denomPub = RsaPublicKey.fromCrock(denom.denom_pub); let coinPriv = EddsaPrivateKey.create(); let coinPub = coinPriv.getPublicKey(); - let blindingFactor = RsaBlindingKey.create(1024); + let blindingFactor = RsaBlindingKey.create(512); let pubHash = coinPub.hash(); console.log("about to blind"); let ev = rsaBlind(pubHash, blindingFactor, denomPub); @@ -206,16 +206,16 @@ function depleteReserve(db, reserve, mint) { } } // Do the request one by one. - function work() { + function next() { if (workList.length == 0) { return; } console.log("doing work"); let w = workList.pop(); withdraw(w[0], w[1], w[2]) - .then(() => work()); + .then(() => next()); } - work(); + next(); } function updateReserve(db, reservePub, mint) { let reserve; |