diff options
author | Florian Dold <florian@dold.me> | 2022-08-26 01:18:01 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-08-26 01:18:01 +0200 |
commit | 30e8fd83c256826fc995edae499bf8bb6b60b7f2 (patch) | |
tree | 994752f4eced988458cf2b9ae3f1c143ca73cdf5 /packages/taler-wallet-core/src/operations/withdraw.ts | |
parent | 70d0199572ee6a95c68dd0b960d80e4ae93c4b0a (diff) | |
download | wallet-core-30e8fd83c256826fc995edae499bf8bb6b60b7f2.tar.xz |
wallet-core: fix revocation, re-introduce reserves object store
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index a33f59162..84890a043 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -1135,6 +1135,22 @@ async function processWithdrawGroupImpl( withdrawalGroup.exchangeBaseUrl, ); + if (withdrawalGroup.denomsSel.selectedDenoms.length === 0) { + await ws.db + .mktx((x) => ({ withdrawalGroups: x.withdrawalGroups })) + .runReadWrite(async (tx) => { + const wg = await tx.withdrawalGroups.get(withdrawalGroupId); + if (!wg) { + return; + } + wg.operationStatus = OperationStatus.Finished; + delete wg.lastError; + delete wg.retryInfo; + await tx.withdrawalGroups.put(wg); + }); + return; + } + const numTotalCoins = withdrawalGroup.denomsSel.selectedDenoms .map((x) => x.count) .reduce((a, b) => a + b); @@ -1709,7 +1725,6 @@ export async function internalCreateWithdrawalGroup( args: { reserveStatus: ReserveRecordStatus; amount: AmountJson; - bankInfo?: ReserveBankInfo; exchangeBaseUrl: string; forcedDenomSel?: ForcedDenomSel; reserveKeyPair?: EddsaKeypair; @@ -1776,12 +1791,17 @@ export async function internalCreateWithdrawalGroup( await ws.db .mktx((x) => ({ withdrawalGroups: x.withdrawalGroups, + reserves: x.reserves, exchanges: x.exchanges, exchangeDetails: x.exchangeDetails, exchangeTrust: x.exchangeTrust, })) .runReadWrite(async (tx) => { await tx.withdrawalGroups.add(withdrawalGroup); + await tx.reserves.put({ + reservePub: withdrawalGroup.reservePub, + reservePriv: withdrawalGroup.reservePriv, + }); if (!isAudited && !isTrusted) { await tx.exchangeTrust.put({ @@ -1906,7 +1926,6 @@ export async function createManualWithdrawal( withdrawalType: WithdrawalRecordType.BankManual, }, exchangeBaseUrl: req.exchangeBaseUrl, - bankInfo: undefined, forcedDenomSel: req.forcedDenomSel, restrictAge: req.restrictAge, reserveStatus: ReserveRecordStatus.QueryingStatus, |