diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 68 |
2 files changed, 39 insertions, 31 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index 773379044..d489ec379 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -273,7 +273,7 @@ async function createLocalWallet( applyVerbose(walletCliArgs.wallet.verbose); const res = { wallet: wh.wallet, getStats: wh.getDbStats }; - if (!noInit) { + if (noInit) { return res; } try { diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index b397c43d5..879508036 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -172,7 +172,6 @@ import { CoinSourceType, ConfigRecordKey, DenominationRecord, - OperationRetryRecord, WalletDbReadOnlyTransaction, WalletStoresV1, clearDatabase, @@ -181,7 +180,6 @@ import { openStoredBackupsDatabase, openTalerDatabase, timestampAbsoluteFromDb, - timestampPreciseFromDb, timestampProtocolToDb, } from "./db.js"; import { @@ -519,9 +517,9 @@ async function dumpCoins(wex: WalletExecutionContext): Promise<CoinDumpJson> { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -989,31 +987,41 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( return {}; } case WalletApiOperation.GetActiveTasks: { - const allTasksId = wex.taskScheduler.getActiveTasks() + const allTasksId = wex.taskScheduler.getActiveTasks(); + + const tasksInfo = await Promise.all( + allTasksId.map(async (id) => { + return await wex.ws.db.runReadOnlyTx( + ["operationRetries"], + async (tx) => { + return tx.operationRetries.get(id); + }, + ); + }), + ); - const tasksInfo = await Promise.all(allTasksId.map(async (id) => { - return await wex.ws.db.runReadOnlyTx( - ["operationRetries"], - async (tx) => { - return tx.operationRetries.get(id); - }, - ) - })) - - const tasks = allTasksId - .map((taskId, i): ActiveTask => { - const transaction = convertTaskToTransactionId(taskId); - const d = tasksInfo[i] - - const firstTry = !d?undefined:timestampAbsoluteFromDb(d.retryInfo.firstTry) - const nextTry = !d?undefined:timestampAbsoluteFromDb(d.retryInfo.nextRetry) - const counter = d?.retryInfo.retryCounter - const lastError = d?.lastError - - return { - id: taskId, counter, firstTry, nextTry, lastError, transaction - } - }) + const tasks = allTasksId.map((taskId, i): ActiveTask => { + const transaction = convertTaskToTransactionId(taskId); + const d = tasksInfo[i]; + + const firstTry = !d + ? undefined + : timestampAbsoluteFromDb(d.retryInfo.firstTry); + const nextTry = !d + ? undefined + : timestampAbsoluteFromDb(d.retryInfo.nextRetry); + const counter = d?.retryInfo.retryCounter; + const lastError = d?.lastError; + + return { + id: taskId, + counter, + firstTry, + nextTry, + lastError, + transaction, + }; + }); return { tasks }; } case WalletApiOperation.FailTransaction: { @@ -1491,7 +1499,7 @@ async function handleCoreApiRequest( wex = getObservedWalletExecutionContext(ws, CancellationToken.CONTINUE, oc); } else { oc = { - observe(evt) { }, + observe(evt) {}, }; wex = getNormalWalletExecutionContext(ws, CancellationToken.CONTINUE, oc); } |