From 9c708251f92e6691ebba80fa8d129c6c04cec618 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 20 Jun 2023 11:40:06 +0200 Subject: wallet-core: emit DD37 self-transition notifications with errors --- .../src/operations/backup/index.ts | 62 +++++++++------------- 1 file changed, 25 insertions(+), 37 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/backup/index.ts') diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts index f726167da..364e876ec 100644 --- a/packages/taler-wallet-core/src/operations/backup/index.ts +++ b/packages/taler-wallet-core/src/operations/backup/index.ts @@ -29,52 +29,52 @@ import { AmountString, AttentionType, BackupRecovery, + Codec, + DenomKeyType, + EddsaKeyPair, + HttpStatusCode, + Logger, + PreparePayResult, + PreparePayResultType, + RecoveryLoadRequest, + RecoveryMergeStrategy, + TalerError, + TalerErrorCode, + TalerErrorDetail, + TalerPreciseTimestamp, + URL, + WalletBackupContentV1, buildCodecForObject, buildCodecForUnion, bytesToString, - canonicalizeBaseUrl, canonicalJson, - Codec, + canonicalizeBaseUrl, codecForAmountString, codecForBoolean, codecForConstString, codecForList, codecForNumber, codecForString, - codecForTalerErrorDetail, codecOptional, - ConfirmPayResultType, decodeCrock, - DenomKeyType, durationFromSpec, eddsaGetPublic, - EddsaKeyPair, encodeCrock, getRandomBytes, hash, hashDenomPub, - HttpStatusCode, j2s, kdf, - Logger, notEmpty, - PaymentStatus, - PreparePayResult, - PreparePayResultType, - RecoveryLoadRequest, - RecoveryMergeStrategy, - ReserveTransactionType, rsaBlind, secretbox, secretbox_open, stringToBytes, - TalerErrorCode, - TalerErrorDetail, - TalerProtocolTimestamp, - TalerPreciseTimestamp, - URL, - WalletBackupContentV1, } from "@gnu-taler/taler-util"; +import { + readSuccessResponseJsonOrThrow, + readTalerErrorResponse, +} from "@gnu-taler/taler-util/http"; import { gunzipSync, gzipSync } from "fflate"; import { TalerCryptoInterface } from "../../crypto/cryptoImplementation.js"; import { @@ -86,29 +86,19 @@ import { ConfigRecordKey, WalletBackupConfState, } from "../../db.js"; -import { TalerError } from "@gnu-taler/taler-util"; import { InternalWalletState } from "../../internal-wallet-state.js"; import { assertUnreachable } from "../../util/assertUnreachable.js"; -import { - readSuccessResponseJsonOrThrow, - readTalerErrorResponse, -} from "@gnu-taler/taler-util/http"; import { checkDbInvariant, checkLogicInvariant, } from "../../util/invariants.js"; +import { addAttentionRequest, removeAttentionRequest } from "../attention.js"; import { OperationAttemptResult, OperationAttemptResultType, TaskIdentifiers, - scheduleRetryInTx, -} from "../../util/retries.js"; -import { addAttentionRequest, removeAttentionRequest } from "../attention.js"; -import { - checkPaymentByProposalId, - confirmPay, - preparePayForUri, -} from "../pay-merchant.js"; +} from "../common.js"; +import { checkPaymentByProposalId, preparePayForUri } from "../pay-merchant.js"; import { exportBackup } from "./export.js"; import { BackupCryptoPrecomputedData, importBackup } from "./import.js"; import { getWalletBackupState, provideBackupState } from "./state.js"; @@ -380,8 +370,6 @@ async function runBackupCycleForProvider( logger.warn("backup provider not found anymore"); return; } - const opId = TaskIdentifiers.forBackup(prov); - await scheduleRetryInTx(ws, tx, opId); prov.shouldRetryFreshProposal = true; prov.state = { tag: BackupProviderStateTag.Retrying, @@ -407,7 +395,7 @@ async function runBackupCycleForProvider( return; } const opId = TaskIdentifiers.forBackup(prov); - await scheduleRetryInTx(ws, tx, opId); + //await scheduleRetryInTx(ws, tx, opId); prov.currentPaymentProposalId = result.proposalId; prov.shouldRetryFreshProposal = false; prov.state = { @@ -481,7 +469,7 @@ async function runBackupCycleForProvider( // FIXME: Allocate error code for this situation? // FIXME: Add operation retry record! const opId = TaskIdentifiers.forBackup(prov); - await scheduleRetryInTx(ws, tx, opId); + //await scheduleRetryInTx(ws, tx, opId); prov.state = { tag: BackupProviderStateTag.Retrying, }; -- cgit v1.2.3