aboutsummaryrefslogtreecommitdiff
path: root/src/operations/balance.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-05-11 18:03:25 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-05-11 18:03:25 +0530
commit5d6192b0cd356f7e56fa8d6193a2e74233a52f4b (patch)
tree0360ba1d39e6ff081e25045652f457faca8cb879 /src/operations/balance.ts
parent7e947ca2cdd8e66ea49822acbad81e7d35289c0a (diff)
downloadwallet-core-5d6192b0cd356f7e56fa8d6193a2e74233a52f4b.tar.xz
make planchet management during withdrawal O(n) instead of O(n^2)
Diffstat (limited to 'src/operations/balance.ts')
-rw-r--r--src/operations/balance.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/operations/balance.ts b/src/operations/balance.ts
index c369af193..b5c1ec79e 100644
--- a/src/operations/balance.ts
+++ b/src/operations/balance.ts
@@ -106,18 +106,19 @@ export async function getBalancesInsideTransaction(
}
});
- await tx.iter(Stores.withdrawalGroups).forEach((wds) => {
- let w = wds.totalCoinValue;
- for (let i = 0; i < wds.planchets.length; i++) {
- if (wds.withdrawn[i]) {
- const p = wds.planchets[i];
- if (p) {
- w = Amounts.sub(w, p.coinValue).amount;
- }
- }
- }
- addTo(balanceStore, "pendingIncoming", w, wds.exchangeBaseUrl);
- });
+ // FIXME: re-implement
+ // await tx.iter(Stores.withdrawalGroups).forEach((wds) => {
+ // let w = wds.totalCoinValue;
+ // for (let i = 0; i < wds.planchets.length; i++) {
+ // if (wds.withdrawn[i]) {
+ // const p = wds.planchets[i];
+ // if (p) {
+ // w = Amounts.sub(w, p.coinValue).amount;
+ // }
+ // }
+ // }
+ // addTo(balanceStore, "pendingIncoming", w, wds.exchangeBaseUrl);
+ // });
await tx.iter(Stores.purchases).forEach((t) => {
if (t.timestampFirstSuccessfulPay) {