diff options
author | Florian Dold <florian@dold.me> | 2021-04-07 19:29:51 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-04-07 19:29:51 +0200 |
commit | 4fa88007f958796d7fe65d0fe4f6f45fcf953887 (patch) | |
tree | 4f6e5798cc74b19b6eda13dfcd5daa855a5c8c9a /packages/taler-wallet-core/src/operations/reserves.ts | |
parent | 29d710c392c2b28e8c8c2a177c8de40061a58e77 (diff) | |
download | wallet-core-4fa88007f958796d7fe65d0fe4f6f45fcf953887.tar.xz |
get coin re-selection after accidental double spending to work
Diffstat (limited to 'packages/taler-wallet-core/src/operations/reserves.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/reserves.ts | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts index fe6f323c8..9467287a7 100644 --- a/packages/taler-wallet-core/src/operations/reserves.ts +++ b/packages/taler-wallet-core/src/operations/reserves.ts @@ -33,15 +33,46 @@ import { addPaytoQueryParams, } from "@gnu-taler/taler-util"; import { randomBytes } from "../crypto/primitives/nacl-fast.js"; -import { Stores, ReserveRecordStatus, ReserveBankInfo, ReserveRecord, CurrencyRecord, WithdrawalGroupRecord } from "../db.js"; -import { Logger, encodeCrock, getRandomBytes, readSuccessResponseJsonOrThrow, URL, readSuccessResponseJsonOrErrorCode, throwUnexpectedRequestError, TransactionHandle } from "../index.js"; +import { + Stores, + ReserveRecordStatus, + ReserveBankInfo, + ReserveRecord, + CurrencyRecord, + WithdrawalGroupRecord, +} from "../db.js"; +import { + Logger, + encodeCrock, + getRandomBytes, + readSuccessResponseJsonOrThrow, + URL, + readSuccessResponseJsonOrErrorCode, + throwUnexpectedRequestError, + TransactionHandle, +} from "../index.js"; import { assertUnreachable } from "../util/assertUnreachable.js"; -import { canonicalizeBaseUrl } from "../util/helpers.js"; -import { initRetryInfo, getRetryDuration, updateRetryInfoTimeout } from "../util/retries.js"; +import { canonicalizeBaseUrl } from "@gnu-taler/taler-util"; +import { + initRetryInfo, + getRetryDuration, + updateRetryInfoTimeout, +} from "../util/retries.js"; import { guardOperationException, OperationFailedError } from "./errors.js"; -import { updateExchangeFromUrl, getExchangeTrust, getExchangePaytoUri } from "./exchanges.js"; +import { + updateExchangeFromUrl, + getExchangeTrust, + getExchangePaytoUri, +} from "./exchanges.js"; import { InternalWalletState } from "./state.js"; -import { updateWithdrawalDenoms, getCandidateWithdrawalDenoms, selectWithdrawalDenominations, denomSelectionInfoToState, processWithdrawGroup, getBankWithdrawalInfo } from "./withdraw.js"; +import { + updateWithdrawalDenoms, + getCandidateWithdrawalDenoms, + selectWithdrawalDenominations, + denomSelectionInfoToState, + processWithdrawGroup, + getBankWithdrawalInfo, +} from "./withdraw.js"; const logger = new Logger("reserves.ts"); @@ -488,7 +519,10 @@ async function updateReserve( const currency = balance.currency; await updateWithdrawalDenoms(ws, reserve.exchangeBaseUrl); - const denoms = await getCandidateWithdrawalDenoms(ws, reserve.exchangeBaseUrl); + const denoms = await getCandidateWithdrawalDenoms( + ws, + reserve.exchangeBaseUrl, + ); const newWithdrawalGroup = await ws.db.runWithWriteTransaction( [Stores.coins, Stores.planchets, Stores.withdrawalGroups, Stores.reserves], |