taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 0be7e3940a0e4a29eada737862acd808e2061df5
parent 82e02445f553cd37076bc23bdb61118419301549
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 30 Oct 2026 10:42:38 +0100

Keep WalletExchangeDetails.maxPeerPushExpiration in database.

Diffstat:
Mpackages/taler-wallet-core/src/db/sqlite/schema.ts | 13+++++++++++--
Mpackages/taler-wallet-core/src/db/sqlite/transaction.ts | 21++++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/packages/taler-wallet-core/src/db/sqlite/schema.ts b/packages/taler-wallet-core/src/db/sqlite/schema.ts @@ -85,7 +85,7 @@ * * Bump this when adding a migration to {@link schemaMigrations}. */ -export const SQLITE_SCHEMA_VERSION = 25; +export const SQLITE_SCHEMA_VERSION = 26; /** * Tables of the IndexedDB emulation, children before parents. @@ -1041,7 +1041,9 @@ CREATE TABLE IF NOT EXISTS exchange_details ( zero_limits TEXT, bank_compliance_language TEXT, -- JSON: TalerProtocolDuration - default_peer_push_expiration TEXT + default_peer_push_expiration TEXT, + -- JSON: TalerProtocolDuration; absent before exchange protocol v42 + max_peer_push_expiration TEXT ); -- The pointer identifies at most one details row. CREATE UNIQUE INDEX IF NOT EXISTS exchange_details_by_pointer @@ -1528,6 +1530,13 @@ export const schemaMigrations: SchemaMigration[] = [ "ALTER TABLE mailbox_messages ADD COLUMN subject_hint TEXT", ], }, + { + version: 26, + name: "exchange-max-p2p-expiration", + statements: [ + "ALTER TABLE exchange_details ADD COLUMN max_peer_push_expiration TEXT", + ], + }, ]; /** Native tables that contain wallet records (not schema bookkeeping). */ diff --git a/packages/taler-wallet-core/src/db/sqlite/transaction.ts b/packages/taler-wallet-core/src/db/sqlite/transaction.ts @@ -1871,6 +1871,14 @@ export class SqliteWalletTransaction implements WalletDbTransaction { ...(row.zero_limits != null ? { zeroLimits: dbToJson(row.zero_limits) } : undefined), + // Conditional, like the other optionals above: an exchange below + // protocol v42 does not send this, and the record then has no such + // key at all. Setting it to undefined unconditionally would make the + // record differ from its IndexedDB original and fail the backend + // conversion's verification digest. + ...(row.max_peer_push_expiration != null + ? { maxPeerPushExpiration: dbToJson(row.max_peer_push_expiration) } + : undefined), }; } @@ -1898,6 +1906,10 @@ export class SqliteWalletTransaction implements WalletDbTransaction { rec.defaultPeerPushExpiration === undefined ? null : jsonToDb(rec.defaultPeerPushExpiration), + mppe: + rec.maxPeerPushExpiration === undefined + ? null + : jsonToDb(rec.maxPeerPushExpiration), }; } @@ -1907,10 +1919,11 @@ export class SqliteWalletTransaction implements WalletDbTransaction { " protocol_version_range, tiny_amount, reserve_closing_delay," + " shopping_url, global_fees, wire_info, age_mask," + " wallet_balance_limits, hard_limits, zero_limits," + - " bank_compliance_language, default_peer_push_expiration"; + " bank_compliance_language, default_peer_push_expiration," + + " max_peer_push_expiration"; const values = "$url, $mpk, $cur, $aud, $pvr, $tiny, $rcd, $surl, $gf, $wi, $am," + - " $wbl, $hl, $zl, $bcl, $dppe"; + " $wbl, $hl, $zl, $bcl, $dppe, $mppe"; const cols = this.exchangeDetailsCols(rec); if (rec.rowId != null) { await this.run( @@ -1933,7 +1946,9 @@ export class SqliteWalletTransaction implements WalletDbTransaction { " zero_limits = excluded.zero_limits," + " bank_compliance_language = excluded.bank_compliance_language," + " default_peer_push_expiration =" + - " excluded.default_peer_push_expiration", + " excluded.default_peer_push_expiration," + + " max_peer_push_expiration =" + + " excluded.max_peer_push_expiration", { row_id: rec.rowId, ...cols }, ); return rec.rowId;