summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-06-26 19:27:34 +0200
committerFlorian Dold <florian@dold.me>2023-06-26 19:27:42 +0200
commita844136489611525726c117cb28086b854bee5c0 (patch)
treebb3384fab39600c35675cd8e36caac9246ef9782 /packages/taler-wallet-core/src/db.ts
parent2779086a32a62d6d16b7813c2ca4944dc02c4d93 (diff)
downloadwallet-core-a844136489611525726c117cb28086b854bee5c0.tar.gz
wallet-core-a844136489611525726c117cb28086b854bee5c0.tar.bz2
wallet-core-a844136489611525726c117cb28086b854bee5c0.zip
wallet-core: make changes to available amount atomic
W.r.t. transactions
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts37
1 files changed, 34 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index ab2e95c23..89bb8b053 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -119,7 +119,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 8;
+export const WALLET_DB_MINOR_VERSION = 9;
/**
* Ranges for operation status fields.
@@ -724,6 +724,14 @@ export interface CoinRecord {
coinSource: CoinSource;
/**
+ * Source transaction ID of the coin.
+ *
+ * Used to make the coin visible after the transaction
+ * has entered a final state.
+ */
+ sourceTransactionId?: string;
+
+ /**
* Public key of the coin.
*/
coinPub: string;
@@ -769,6 +777,14 @@ export interface CoinRecord {
status: CoinStatus;
/**
+ * Non-zero for visible.
+ *
+ * A coin is visible when it is fresh and the
+ * source transaction is in a final state.
+ */
+ visible?: number;
+
+ /**
* Information about what the coin has been allocated for.
*
* Used for:
@@ -894,7 +910,7 @@ export enum RefreshCoinStatus {
* The refresh for this coin has been frozen, because of a permanent error.
* More info in lastErrorPerCoin.
*/
- Frozen = OperationStatusRange.DORMANT_START + 1,
+ Failed = OperationStatusRange.DORMANT_START + 1,
}
export enum OperationStatus {
@@ -1748,7 +1764,6 @@ export interface DepositKycInfo {
exchangeBaseUrl: string;
}
-
/**
* Record for a deposits that the wallet observed
* as a result of double spending, but which is not
@@ -2132,6 +2147,15 @@ export interface CoinAvailabilityRecord {
* Number of fresh coins of this denomination that are available.
*/
freshCoinCount: number;
+
+ /**
+ * Number of fresh coins that are available
+ * and visible, i.e. the source transaction is in
+ * a final state.
+ *
+ * (Optional for backwards compatibility, defaults to 0.)
+ */
+ visibleCoinCount?: number;
}
export interface ContractTermsRecord {
@@ -2318,6 +2342,13 @@ export const WalletStoresV1 = {
["exchangeBaseUrl", "denomPubHash", "maxAge", "status"],
),
byCoinEvHash: describeIndex("byCoinEvHash", "coinEvHash"),
+ bySourceTransactionId: describeIndex(
+ "bySourceTransactionId",
+ "sourceTransactionId",
+ {
+ versionAdded: 9,
+ },
+ ),
},
),
reserves: describeStore(