commit 28172705761652c22e5cdcd701ab3851e4955acc
parent e1066098dab59afa9f052748fb0f88503677f302
Author: Florian Dold <florian@dold.me>
Date: Mon, 15 Sep 2025 23:56:29 +0200
wallet-core: improved TOPS blunder and SPURLOS fixup
Diffstat:
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
@@ -66,7 +66,6 @@ import {
TokenIssuePublicKey,
TokenUseSig,
TransactionIdStr,
- TransactionType,
UnblindedDenominationSignature,
WireInfo,
WithdrawalExchangeAccountDetails,
@@ -91,7 +90,6 @@ import {
describeStoreV2,
openDatabase,
} from "./query.js";
-import { rematerializeTransactions } from "./transactions.js";
/**
* This file contains the database schema of the Taler wallet together
@@ -3600,11 +3598,11 @@ export interface FixupDescription {
export const walletDbFixups: FixupDescription[] = [
// Can be removed 2025-11-01.
{
- fn: fixup20250908TopsBlunder,
- name: "fixup20250908TopsBlunder",
+ fn: fixup20250915TopsBlunder,
+ name: "fixup20250915TopsBlunder",
},
// Removing this would cause old transactions
- // to show up under multip,e exchanges
+ // to show up under multiple exchanges
{
fn: fixup20250915TransactionsScope,
name: "fixup20250915TransactionsScope",
@@ -3622,7 +3620,6 @@ async function fixup20250915TransactionsScope(
tx: WalletDbAllStoresReadWriteTransaction,
): Promise<void> {
await tx.purchases.iter().forEachAsync(async (rec) => {
- let hadFix = false;
if (
(rec.exchanges?.length ?? 0) == 0 &&
rec.payInfo?.payCoinSelection != null
@@ -3641,14 +3638,16 @@ async function fixup20250915TransactionsScope(
if (rec.exchanges.length == 0) {
// For old SPURLOS transactions, set exchange manually
// when we can't infer it.
- if (rec.timestamp <= 1736942400000_000 && rec.download?.currency === "SPURLOS") {
+ if (
+ rec.timestamp <= 1736942400000_000 &&
+ rec.download?.currency === "SPURLOS"
+ ) {
rec.exchanges = ["https://exchange.taler.datenspuren.de/"];
}
logger.warn(
`unable to fix up pay transaction ${rec.proposalId}, could not reconstruct exchanges`,
);
}
- hadFix = true;
await tx.purchases.put(rec);
}
});
@@ -3659,7 +3658,7 @@ async function fixup20250915TransactionsScope(
* Make sure to re-request keys and re-do denom selection
* for withdrawal groups with zero selected denominations.
*/
-async function fixup20250908TopsBlunder(
+async function fixup20250915TopsBlunder(
tx: WalletDbAllStoresReadWriteTransaction,
): Promise<void> {
const exchangeUrls = [
@@ -3675,6 +3674,7 @@ async function fixup20250908TopsBlunder(
exchRec.lastUpdate = undefined;
exchRec.lastKeysEtag = undefined;
switch (exchRec.updateStatus) {
+ case ExchangeEntryDbUpdateStatus.ReadyUpdate:
case ExchangeEntryDbUpdateStatus.Ready:
break;
default:
@@ -3687,7 +3687,8 @@ async function fixup20250908TopsBlunder(
exchRec.updateStatus = ExchangeEntryDbUpdateStatus.UnavailableUpdate;
exchRec.nextUpdateStamp = timestampPreciseToDb(TalerPreciseTimestamp.now());
await tx.exchanges.put(exchRec);
-
+ }
+ for (const exch of exchangeUrls) {
const wgs =
await tx.withdrawalGroups.indexes.byExchangeBaseUrl.getAll(exch);
for (const wg of wgs) {