store ToS acceptance timestamp, remove unused backup attributes

This commit is contained in:
Florian Dold 2021-06-14 11:45:05 +02:00
parent 6e11b69cf5
commit cc795f350a
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 18 additions and 16 deletions

View File

@ -806,12 +806,6 @@ export interface BackupPurchase {
*/
refunds: BackupRefundItem[];
/**
* Is the purchase considered defunct (either during payment
* or during abort if abort_status is set).
*/
defunct?: boolean;
/**
* Abort status of the payment.
*/
@ -1006,8 +1000,6 @@ export interface BackupReserve {
* Groups of withdrawal operations for this reserve. Typically just one.
*/
withdrawal_groups: BackupWithdrawalGroup[];
defective?: boolean;
}
/**
@ -1179,12 +1171,12 @@ export interface BackupExchangeDetails {
/**
* ETag for last terms of service download.
*/
tos_etag_last: string | undefined;
tos_accepted_etag: string | undefined;
/**
* ETag for last terms of service download.
* Timestamp when the ToS has been accepted.
*/
tos_etag_accepted: string | undefined;
tos_accepted_timestamp: Timestamp | undefined;
}
export enum BackupProposalStatus {

View File

@ -570,10 +570,17 @@ export interface ExchangeDetailsRecord {
termsOfServiceLastEtag: string | undefined;
/**
* ETag for last terms of service download.
* ETag for last terms of service accepted.
*/
termsOfServiceAcceptedEtag: string | undefined;
/**
* Timestamp when the ToS was accepted.
*
* Used during backup merging.
*/
termsOfServiceAcceptedTimestamp: Timestamp | undefined;
wireInfo: WireInfo;
}

View File

@ -311,8 +311,8 @@ export async function exportBackup(
stamp_expire: x.stamp_expire,
stamp_start: x.stamp_start,
})),
tos_etag_accepted: ex.termsOfServiceAcceptedEtag,
tos_etag_last: ex.termsOfServiceLastEtag,
tos_accepted_etag: ex.termsOfServiceAcceptedEtag,
tos_accepted_timestamp: ex.termsOfServiceAcceptedTimestamp,
denominations:
backupDenominationsByExchange[ex.exchangeBaseUrl] ?? [],
reserves: backupReservesByExchange[ex.exchangeBaseUrl] ?? [],

View File

@ -297,9 +297,11 @@ export async function importBackup(
}
await tx.exchangeDetails.put({
exchangeBaseUrl: backupExchangeDetails.base_url,
termsOfServiceAcceptedEtag: backupExchangeDetails.tos_etag_accepted,
termsOfServiceAcceptedEtag: backupExchangeDetails.tos_accepted_etag,
termsOfServiceText: undefined,
termsOfServiceLastEtag: backupExchangeDetails.tos_etag_last,
termsOfServiceLastEtag: undefined,
termsOfServiceAcceptedTimestamp:
backupExchangeDetails.tos_accepted_timestamp,
wireInfo,
currency: backupExchangeDetails.currency,
auditors: backupExchangeDetails.auditors.map((x) => ({

View File

@ -496,6 +496,7 @@ async function updateExchangeFromUrlImpl(
termsOfServiceText: tosDownload.tosText,
termsOfServiceAcceptedEtag: undefined,
termsOfServiceLastEtag: tosDownload.tosEtag,
termsOfServiceAcceptedTimestamp: getTimestampNow(),
};
// FIXME: only update if pointer got updated
r.lastError = undefined;