From 5d6192b0cd356f7e56fa8d6193a2e74233a52f4b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 11 May 2020 18:03:25 +0530 Subject: make planchet management during withdrawal O(n) instead of O(n^2) --- src/operations/balance.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/operations/balance.ts') 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) { -- cgit v1.2.3