From d1f43ca5f21592a1b1db5cf7e98bb90c02db6eea Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 17 Oct 2022 11:44:23 -0300 Subject: added v6 migration skip and removed rowId field when rowId is undefined (otherwise autoincrement value won't work) --- packages/taler-wallet-core/src/operations/exchanges.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/exchanges.ts') diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index d0da2e948..a8c4fec10 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -674,13 +674,11 @@ export async function updateExchangeFromUrlHandler( logger.warn(`exchange ${exchangeBaseUrl} no longer present`); return; } - let existingDetails = await getExchangeDetails(tx, r.baseUrl); - let acceptedTosEtag: string | undefined = undefined; + const existingDetails = await getExchangeDetails(tx, r.baseUrl); if (!existingDetails) { detailsPointerChanged = true; } if (existingDetails) { - acceptedTosEtag = existingDetails.tosAccepted?.etag; if (existingDetails.masterPublicKey !== keysInfo.masterPublicKey) { detailsPointerChanged = true; } @@ -689,9 +687,8 @@ export async function updateExchangeFromUrlHandler( } // FIXME: We need to do some consistency checks! } - let existingTosAccepted = existingDetails?.tosAccepted; - const newDetails = { - rowId: existingDetails?.rowId, + const existingTosAccepted = existingDetails?.tosAccepted; + const newDetails: ExchangeDetailsRecord = { auditors: keysInfo.auditors, currency: keysInfo.currency, masterPublicKey: keysInfo.masterPublicKey, @@ -703,6 +700,9 @@ export async function updateExchangeFromUrlHandler( tosCurrentEtag: tosDownload.tosEtag, tosAccepted: existingTosAccepted, }; + if (existingDetails?.rowId) { + newDetails.rowId = existingDetails.rowId; + } r.lastUpdate = TalerProtocolTimestamp.now(); r.nextUpdate = keysInfo.expiry; // New denominations might be available. -- cgit v1.2.3