aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-23 13:11:36 +0100
committerFlorian Dold <florian@dold.me>2022-03-23 13:11:36 +0100
commitc539d1803c1376cba0831be64866b6d2c1652403 (patch)
tree20104848bee6fff74ab40d0f8be646d63c6ef9d5 /packages/taler-wallet-core/src/operations
parent739c2f933770206b173a9b3cbafa79ee6048ff9d (diff)
downloadwallet-core-c539d1803c1376cba0831be64866b6d2c1652403.tar.xz
wallet: address crypto worker hang and warning about worker termination
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/backup/index.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/backup/state.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/balance.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts5
-rw-r--r--packages/taler-wallet-core/src/operations/merchants.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/pending.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/recoup.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts8
-rw-r--r--packages/taler-wallet-core/src/operations/refund.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts5
-rw-r--r--packages/taler-wallet-core/src/operations/testing.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts5
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts5
18 files changed, 35 insertions, 29 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index 35306da63..d4c822972 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -57,7 +57,7 @@ import {
stringToBytes,
AbsoluteTime,
} from "@gnu-taler/taler-util";
-import { InternalWalletState } from "../../common.js";
+import { InternalWalletState } from "../../internal-wallet-state.js";
import {
AbortStatus,
CoinSourceType,
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 4b17a5f33..ece0781a8 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -58,7 +58,7 @@ import {
} from "../../util/invariants.js";
import { Logger } from "@gnu-taler/taler-util";
import { initRetryInfo } from "../../util/retries.js";
-import { InternalWalletState } from "../../common.js";
+import { InternalWalletState } from "../../internal-wallet-state.js";
import { provideBackupState } from "./state.js";
import { makeEventId, TombstoneTag } from "../transactions.js";
import { getExchangeDetails } from "../exchanges.js";
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts
index 400406ce3..8ddc0c064 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -55,7 +55,7 @@ import {
TalerProtocolTimestamp,
} from "@gnu-taler/taler-util";
import { gunzipSync, gzipSync } from "fflate";
-import { InternalWalletState } from "../../common.js";
+import { InternalWalletState } from "../../internal-wallet-state.js";
import { kdf } from "@gnu-taler/taler-util";
import { secretbox, secretbox_open } from "@gnu-taler/taler-util";
import {
@@ -80,7 +80,6 @@ import {
WalletStoresV1,
WALLET_BACKUP_STATE_KEY,
} from "../../db.js";
-import { guardOperationException } from "../../errors.js";
import {
readSuccessResponseJsonOrThrow,
readTalerErrorResponse,
@@ -99,6 +98,7 @@ import {
import { exportBackup } from "./export.js";
import { BackupCryptoPrecomputedData, importBackup } from "./import.js";
import { getWalletBackupState, provideBackupState } from "./state.js";
+import { guardOperationException } from "../common.js";
const logger = new Logger("operations/backup.ts");
diff --git a/packages/taler-wallet-core/src/operations/backup/state.ts b/packages/taler-wallet-core/src/operations/backup/state.ts
index dc89c3d99..f25cc170a 100644
--- a/packages/taler-wallet-core/src/operations/backup/state.ts
+++ b/packages/taler-wallet-core/src/operations/backup/state.ts
@@ -23,7 +23,7 @@ import {
} from "../../db.js";
import { checkDbInvariant } from "../../util/invariants.js";
import { GetReadOnlyAccess } from "../../util/query.js";
-import { InternalWalletState } from "../../common.js";
+import { InternalWalletState } from "../../internal-wallet-state.js";
export async function provideBackupState(
ws: InternalWalletState,
diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts
index 298893920..c26eb0cfc 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -25,7 +25,7 @@ import {
} from "@gnu-taler/taler-util";
import { CoinStatus, WalletStoresV1 } from "../db.js";
import { GetReadOnlyAccess } from "../util/query.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
const logger = new Logger("operations/balance.ts");
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 42ce5e7c9..ad3f614f3 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -42,9 +42,8 @@ import {
TrackDepositGroupResponse,
URL,
} from "@gnu-taler/taler-util";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import { DepositGroupRecord, OperationStatus } from "../db.js";
-import { guardOperationException } from "../errors.js";
import { PayCoinSelection, selectPayCoins } from "../util/coinSelection.js";
import { readSuccessResponseJsonOrThrow } from "../util/http.js";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
@@ -57,6 +56,7 @@ import {
getTotalPaymentCost,
} from "./pay.js";
import { getTotalRefreshCost } from "./refresh.js";
+import { guardOperationException } from "./common.js";
/**
* Logger.
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index bbed42288..94159369b 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -64,12 +64,13 @@ import {
} from "../util/http.js";
import { DbAccess, GetReadOnlyAccess } from "../util/query.js";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { guardOperationException, TalerError } from "../errors.js";
-import { InternalWalletState, TrustInfo } from "../common.js";
+import { TalerError } from "../errors.js";
+import { InternalWalletState, TrustInfo } from "../internal-wallet-state.js";
import {
WALLET_CACHE_BREAKER_CLIENT_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION,
} from "../versions.js";
+import { guardOperationException } from "./common.js";
const logger = new Logger("exchanges.ts");
diff --git a/packages/taler-wallet-core/src/operations/merchants.ts b/packages/taler-wallet-core/src/operations/merchants.ts
index fd628fa98..614478715 100644
--- a/packages/taler-wallet-core/src/operations/merchants.ts
+++ b/packages/taler-wallet-core/src/operations/merchants.ts
@@ -24,7 +24,7 @@ import {
codecForMerchantConfigResponse,
LibtoolVersion,
} from "@gnu-taler/taler-util";
-import { InternalWalletState, MerchantInfo } from "../common.js";
+import { InternalWalletState, MerchantInfo } from "../internal-wallet-state.js";
import { readSuccessResponseJsonOrThrow } from "../index.js";
const logger = new Logger("taler-wallet-core:merchants.ts");
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index ce3a26c34..dcfd6841d 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -55,7 +55,7 @@ import {
TransactionType,
URL,
} from "@gnu-taler/taler-util";
-import { EXCHANGE_COINS_LOCK, InternalWalletState } from "../common.js";
+import { EXCHANGE_COINS_LOCK, InternalWalletState } from "../internal-wallet-state.js";
import {
AbortStatus,
AllowedAuditorInfo,
@@ -71,7 +71,6 @@ import {
WalletStoresV1,
} from "../db.js";
import {
- guardOperationException,
makeErrorDetail,
makePendingOperationFailedError,
TalerError,
@@ -100,6 +99,7 @@ import {
} from "../util/retries.js";
import { getExchangeDetails } from "./exchanges.js";
import { createRefreshGroup, getTotalRefreshCost } from "./refresh.js";
+import { guardOperationException } from "./common.js";
/**
* Logger.
diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts
index fc76eeb19..71b8b34f4 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -36,7 +36,7 @@ import {
ReserveType,
} from "../pending-types.js";
import { AbsoluteTime } from "@gnu-taler/taler-util";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import { GetReadOnlyAccess } from "../util/query.js";
async function gatherExchangePending(
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts
index 56c13f1b0..e30f09808 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -49,11 +49,11 @@ import {
import { readSuccessResponseJsonOrThrow } from "../util/http.js";
import { Logger, URL } from "@gnu-taler/taler-util";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { guardOperationException } from "../errors.js";
import { createRefreshGroup, processRefreshGroup } from "./refresh.js";
import { getReserveRequestTimeout, processReserve } from "./reserves.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import { GetReadWriteAccess } from "../util/query.js";
+import { guardOperationException } from "./common.js";
const logger = new Logger("operations/recoup.ts");
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 7753992f7..c422674a9 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -61,13 +61,12 @@ import {
AbsoluteTime,
URL,
} from "@gnu-taler/taler-util";
-import { guardOperationException } from "../errors.js";
import { updateExchangeFromUrl } from "./exchanges.js";
import {
DenomInfo,
EXCHANGE_COINS_LOCK,
InternalWalletState,
-} from "../common.js";
+} from "../internal-wallet-state.js";
import {
isWithdrawableDenom,
selectWithdrawalDenominations,
@@ -78,6 +77,8 @@ import {
} from "../crypto/cryptoTypes.js";
import { GetReadWriteAccess } from "../util/query.js";
import { CryptoApi } from "../index.browser.js";
+import { guardOperationException } from "./common.js";
+import { CryptoApiStoppedError } from "../crypto/workers/cryptoApi.js";
const logger = new Logger("refresh.ts");
@@ -944,6 +945,9 @@ export async function createRefreshGroup(
logger.info(`created refresh group ${refreshGroupId}`);
processRefreshGroup(ws, refreshGroupId).catch((e) => {
+ if (e instanceof CryptoApiStoppedError) {
+ return;
+ }
logger.warn(`processing refresh group ${refreshGroupId} failed: ${e}`);
});
diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts
index d888ff015..4190bee7f 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -59,9 +59,9 @@ import { readSuccessResponseJsonOrThrow } from "../util/http.js";
import { checkDbInvariant } from "../util/invariants.js";
import { GetReadWriteAccess } from "../util/query.js";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { guardOperationException } from "../errors.js";
import { createRefreshGroup, getTotalRefreshCost } from "./refresh.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
+import { guardOperationException } from "./common.js";
const logger = new Logger("refund.ts");
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index baa977033..dd0fa5423 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -38,7 +38,7 @@ import {
AbsoluteTime,
URL,
} from "@gnu-taler/taler-util";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import {
OperationStatus,
ReserveBankInfo,
@@ -47,7 +47,7 @@ import {
WalletStoresV1,
WithdrawalGroupRecord,
} from "../db.js";
-import { guardOperationException, TalerError } from "../errors.js";
+import { TalerError } from "../errors.js";
import { assertUnreachable } from "../util/assertUnreachable.js";
import {
readSuccessResponseJsonOrErrorCode,
@@ -74,6 +74,7 @@ import {
selectWithdrawalDenominations,
updateWithdrawalDenoms,
} from "./withdraw.js";
+import { guardOperationException } from "./common.js";
const logger = new Logger("taler-wallet-core:reserves.ts");
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts
index 23fee56c1..555e2d73d 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -35,7 +35,7 @@ import {
PreparePayResultType,
} from "@gnu-taler/taler-util";
import { createTalerWithdrawReserve } from "./reserves.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import { confirmPay, preparePayForUri } from "./pay.js";
import { getBalances } from "./balance.js";
import { applyRefund } from "./refund.js";
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index 7b3d36a7c..7bd81b825 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -44,9 +44,9 @@ import {
import { j2s } from "@gnu-taler/taler-util";
import { checkDbInvariant, checkLogicInvariant } from "../util/invariants.js";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { guardOperationException, makeErrorDetail } from "../errors.js";
+import { makeErrorDetail } from "../errors.js";
import { updateExchangeFromUrl } from "./exchanges.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import {
getExchangeWithdrawalInfo,
updateWithdrawalDenoms,
@@ -59,6 +59,7 @@ import {
readSuccessResponseJsonOrThrow,
} from "../util/http.js";
import { encodeCrock, getRandomBytes } from "@gnu-taler/taler-util";
+import { guardOperationException } from "./common.js";
const logger = new Logger("operations/tip.ts");
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index bc466f5a0..cb312154e 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -31,7 +31,7 @@ import {
WithdrawalDetails,
WithdrawalType,
} from "@gnu-taler/taler-util";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import {
AbortStatus,
RefundState,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 1d7bf9303..b7feae06a 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -65,16 +65,15 @@ import {
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
import {
getErrorDetailFromException,
- guardOperationException,
makeErrorDetail,
- makePendingOperationFailedError,
TalerError,
} from "../errors.js";
-import { InternalWalletState } from "../common.js";
+import { InternalWalletState } from "../internal-wallet-state.js";
import {
WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION,
} from "../versions.js";
+import { guardOperationException } from "./common.js";
/**
* Logger for this file.