aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/taler-wallet-core/src/db.ts43
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/pending.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts1
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts1
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts3
6 files changed, 37 insertions, 19 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 8ed4fe85e..493f1a1d0 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -65,6 +65,8 @@ import { Event, IDBDatabase } from "@gnu-taler/idb-bridge";
* - Every record that has a corresponding transaction item must have
* an index for a mandatory timestamp field.
* - Optional fields should be avoided, use "T | undefined" instead.
+ * - Do all records have some obvious, indexed field that can
+ * be used for range queries?
*
* @author Florian Dold <dold@taler.net>
*/
@@ -99,8 +101,8 @@ export const WALLET_DB_MINOR_VERSION = 1;
export namespace OperationStatusRange {
export const ACTIVE_START = 10;
export const ACTIVE_END = 29;
- export const DORMANT_START = 40;
- export const DORMANT_END = 59;
+ export const DORMANT_START = 50;
+ export const DORMANT_END = 69;
}
/**
@@ -148,7 +150,7 @@ export interface ReserveBankInfo {
* URL that the user can be redirected to, and allows
* them to confirm (or abort) the bank-integrated withdrawal.
*/
- confirmUrl?: string;
+ confirmUrl: string | undefined;
/**
* Exchange payto URI that the bank will use to fund the reserve.
@@ -162,14 +164,14 @@ export interface ReserveBankInfo {
*
* Set to undefined if that hasn't happened yet.
*/
- timestampReserveInfoPosted?: TalerProtocolTimestamp;
+ timestampReserveInfoPosted: TalerProtocolTimestamp | undefined;
/**
* Time when the reserve was confirmed by the bank.
*
* Set to undefined if not confirmed yet.
*/
- timestampBankConfirmed?: TalerProtocolTimestamp;
+ timestampBankConfirmed: TalerProtocolTimestamp | undefined;
}
/**
@@ -195,6 +197,8 @@ export interface AuditorTrustRecord {
/**
* UIDs for the operation of adding this auditor
* as a trusted auditor.
+ *
+ * (Used for backup/sync merging and tombstones.)
*/
uids: string[];
}
@@ -232,15 +236,17 @@ export enum DenominationVerificationStatus {
/**
* Verification was delayed.
*/
- Unverified = "unverified",
+ Unverified = OperationStatusRange.ACTIVE_START,
+
/**
* Verified as valid.
*/
- VerifiedGood = "verified-good",
+ VerifiedGood = OperationStatusRange.DORMANT_START,
+
/**
* Verified as invalid.
*/
- VerifiedBad = "verified-bad",
+ VerifiedBad = OperationStatusRange.DORMANT_START + 1,
}
export interface DenomFees {
@@ -705,13 +711,16 @@ export interface CoinRecord {
/**
* Information about what the coin has been allocated for.
- * Used to prevent allocation of the same coin for two different payments.
+ *
+ * Used for:
+ * - Diagnostics
+ * - Idempotency of applying a coin selection (e.g. after re-selection)
*/
- allocation?: CoinAllocation;
+ allocation: CoinAllocation | undefined;
maxAge: number;
- ageCommitmentProof?: AgeCommitmentProof;
+ ageCommitmentProof: AgeCommitmentProof | undefined;
}
export interface CoinAllocation {
@@ -801,7 +810,7 @@ export interface ProposalRecord {
/**
* Session ID we got when downloading the contract.
*/
- downloadSessionId?: string;
+ downloadSessionId: string | undefined;
}
/**
@@ -875,19 +884,19 @@ export interface TipRecord {
}
export enum RefreshCoinStatus {
- Pending = "pending",
- Finished = "finished",
+ Pending = OperationStatusRange.ACTIVE_START,
+ Finished = OperationStatusRange.DORMANT_START,
/**
* The refresh for this coin has been frozen, because of a permanent error.
* More info in lastErrorPerCoin.
*/
- Frozen = "frozen",
+ Frozen = OperationStatusRange.DORMANT_START + 1,
}
export enum OperationStatus {
- Finished = "finished",
- Pending = "pending",
+ Finished = OperationStatusRange.DORMANT_START,
+ Pending = OperationStatusRange.ACTIVE_START,
}
export interface RefreshGroupRecord {
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 3a92273df..9997dd09d 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -285,6 +285,10 @@ export async function importCoin(
coinSource,
// FIXME!
maxAge: AgeRestriction.AGE_UNRESTRICTED,
+ // FIXME!
+ ageCommitmentProof: undefined,
+ // FIXME!
+ allocation: undefined,
};
if (coinRecord.status === CoinStatus.Fresh) {
await makeCoinAvailable(ws, tx, coinRecord);
@@ -655,6 +659,8 @@ export async function importBackup(
repurchaseProposalId: backupProposal.repurchase_proposal_id,
download,
proposalStatus,
+ // FIXME!
+ downloadSessionId: undefined,
});
}
}
diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts
index 18e8ec83b..0dcd09e25 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -28,8 +28,6 @@ import {
BackupProviderStateTag,
RefreshCoinStatus,
OperationStatus,
- WithdrawalGroupRecord,
- WithdrawalGroupStatus,
OperationStatusRange,
} from "../db.js";
import {
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 55070618f..9fe2e6a8f 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -682,6 +682,7 @@ async function refreshReveal(
coinEvHash: pc.coinEvHash,
maxAge: pc.maxAge,
ageCommitmentProof: pc.ageCommitmentProof,
+ allocation: undefined,
};
coins.push(coin);
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index a0fd8d328..bd5ff51e7 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -320,6 +320,7 @@ export async function processTip(
coinEvHash: planchet.coinEvHash,
maxAge: AgeRestriction.AGE_UNRESTRICTED,
ageCommitmentProof: planchet.ageCommitmentProof,
+ allocation: undefined,
});
}
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index ce910363f..cedb62361 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -834,6 +834,7 @@ async function processPlanchetVerifyAndStoreCoin(
},
maxAge: planchet.maxAge,
ageCommitmentProof: planchet.ageCommitmentProof,
+ allocation: undefined,
};
const planchetCoinPub = planchet.coinPub;
@@ -1832,6 +1833,8 @@ export async function acceptWithdrawalFromUri(
exchangePaytoUri,
talerWithdrawUri: req.talerWithdrawUri,
confirmUrl: withdrawInfo.confirmTransferUrl,
+ timestampBankConfirmed: undefined,
+ timestampReserveInfoPosted: undefined,
},
},
restrictAge: req.restrictAge,