From c493a3069ec330b955efd8604cb9d8b76277c74e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 13 Dec 2021 11:28:15 +0100 Subject: wallet-core: reset reserve retry when resetting withdrawal retry --- .../src/operations/transactions.ts | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/transactions.ts') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index b00779fa2..106d72d02 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -19,12 +19,25 @@ */ import { AmountJson, - Amounts, OrderShortInfo, PaymentStatus, timestampCmp, Transaction, TransactionsRequest, - TransactionsResponse, TransactionType, WithdrawalDetails, WithdrawalType + Amounts, + Logger, + OrderShortInfo, + PaymentStatus, + timestampCmp, + Transaction, + TransactionsRequest, + TransactionsResponse, + TransactionType, + WithdrawalDetails, + WithdrawalType, } from "@gnu-taler/taler-util"; import { InternalWalletState } from "../common.js"; import { - AbortStatus, RefundState, ReserveRecord, ReserveRecordStatus, WalletRefundItem + AbortStatus, + RefundState, + ReserveRecord, + ReserveRecordStatus, + WalletRefundItem, } from "../db.js"; import { processDepositGroup } from "./deposits.js"; import { getExchangeDetails } from "./exchanges.js"; @@ -34,6 +47,8 @@ import { getFundingPaytoUris } from "./reserves.js"; import { processTip } from "./tip.js"; import { processWithdrawGroup } from "./withdraw.js"; +const logger = new Logger("taler-wallet-core:transactions.ts"); + /** * Create an event ID from the type and the primary key for the event. */ @@ -404,13 +419,6 @@ export enum TombstoneTag { DeleteRefund = "delete-refund", } -export async function retryTransactionNow( - ws: InternalWalletState, - transactionId: string, -): Promise { - const [type, ...rest] = transactionId.split(":"); -} - /** * Immediately retry the underlying operation * of a transaction. @@ -419,6 +427,8 @@ export async function retryTransaction( ws: InternalWalletState, transactionId: string, ): Promise { + logger.info(`retrying transaction ${transactionId}`); + const [type, ...rest] = transactionId.split(":"); switch (type) { @@ -478,8 +488,8 @@ export async function deleteTransaction( const reserveRecord: | ReserveRecord | undefined = await tx.reserves.indexes.byInitialWithdrawalGroupId.get( - withdrawalGroupId, - ); + withdrawalGroupId, + ); if (reserveRecord && !reserveRecord.initialWithdrawalStarted) { const reservePub = reserveRecord.reservePub; await tx.reserves.delete(reservePub); -- cgit v1.2.3