diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-05-11 18:03:25 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-05-11 18:03:25 +0530 |
commit | 5d6192b0cd356f7e56fa8d6193a2e74233a52f4b (patch) | |
tree | 0360ba1d39e6ff081e25045652f457faca8cb879 /src/operations/history.ts | |
parent | 7e947ca2cdd8e66ea49822acbad81e7d35289c0a (diff) | |
download | wallet-core-5d6192b0cd356f7e56fa8d6193a2e74233a52f4b.tar.gz wallet-core-5d6192b0cd356f7e56fa8d6193a2e74233a52f4b.tar.bz2 wallet-core-5d6192b0cd356f7e56fa8d6193a2e74233a52f4b.zip |
make planchet management during withdrawal O(n) instead of O(n^2)
Diffstat (limited to 'src/operations/history.ts')
-rw-r--r-- | src/operations/history.ts | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/operations/history.ts b/src/operations/history.ts index f32dbbe2d..669a6cf85 100644 --- a/src/operations/history.ts +++ b/src/operations/history.ts @@ -22,7 +22,6 @@ import { Stores, ProposalStatus, ProposalRecord, - PlanchetRecord, } from "../types/dbTypes"; import { Amounts } from "../util/amounts"; import { AmountJson } from "../util/amounts"; @@ -34,7 +33,6 @@ import { ReserveType, ReserveCreationDetail, VerbosePayCoinDetails, - VerboseWithdrawDetails, VerboseRefreshDetails, } from "../types/history"; import { assertUnreachable } from "../util/assertUnreachable"; @@ -177,6 +175,7 @@ export async function getHistory( Stores.tips, Stores.withdrawalGroups, Stores.payEvents, + Stores.planchets, Stores.refundEvents, Stores.reserveUpdatedEvents, Stores.recoupGroups, @@ -209,23 +208,6 @@ export async function getHistory( tx.iter(Stores.withdrawalGroups).forEach((wsr) => { if (wsr.timestampFinish) { - const cs: PlanchetRecord[] = []; - wsr.planchets.forEach((x) => { - if (x) { - cs.push(x); - } - }); - - let verboseDetails: VerboseWithdrawDetails | undefined = undefined; - if (historyQuery?.extraDebug) { - verboseDetails = { - coins: cs.map((x) => ({ - value: Amounts.stringify(x.coinValue), - denomPub: x.denomPub, - })), - }; - } - history.push({ type: HistoryEventType.Withdrawn, withdrawalGroupId: wsr.withdrawalGroupId, @@ -233,12 +215,12 @@ export async function getHistory( HistoryEventType.Withdrawn, wsr.withdrawalGroupId, ), - amountWithdrawnEffective: Amounts.stringify(wsr.totalCoinValue), + amountWithdrawnEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue), amountWithdrawnRaw: Amounts.stringify(wsr.rawWithdrawalAmount), exchangeBaseUrl: wsr.exchangeBaseUrl, timestamp: wsr.timestampFinish, withdrawalSource: wsr.source, - verboseDetails, + verboseDetails: undefined, }); } }); |