diff options
author | Florian Dold <florian@dold.me> | 2023-09-08 12:26:58 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-08 12:26:58 +0200 |
commit | 50b0b324ae67bea01079d6e9a1d684795f5b430f (patch) | |
tree | 1e9d5ce58827f812e030505a1c2412a4bfe26a8c /packages/taler-wallet-core/src/db.ts | |
parent | 132ece8e53d2c7d69c943a2898ed07411c63f12f (diff) | |
download | wallet-core-50b0b324ae67bea01079d6e9a1d684795f5b430f.tar.xz |
wallet-core: put refresh sessions into own store
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 679ca2842..359569055 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -107,6 +107,8 @@ import { RetryInfo, TaskIdentifiers } from "./operations/common.js"; full contract terms from the DB quite often. Instead, we should probably extract what we need into a separate object store. + - More object stores should have an "id" primary key, + as this makes referencing less expensive. */ /** @@ -943,9 +945,6 @@ export interface RefreshReasonDetails { export interface RefreshGroupRecord { operationStatus: RefreshOperationStatus; - // FIXME: Put this into a different object store? - lastErrorPerCoin: { [coinIndex: number]: TalerErrorDetail }; - /** * Unique, randomly generated identifier for this group of * refresh operations. @@ -969,13 +968,9 @@ export interface RefreshGroupRecord { oldCoinPubs: string[]; - // FIXME: Should this go into a separate - // object store for faster updates? - refreshSessionPerCoin: (RefreshSessionRecord | undefined)[]; - inputPerCoin: AmountString[]; - estimatedOutputPerCoin: AmountString[]; + expectedOutputPerCoin: AmountString[]; /** * Flag for each coin whether refreshing finished. @@ -997,6 +992,13 @@ export interface RefreshGroupRecord { * Ongoing refresh */ export interface RefreshSessionRecord { + refreshGroupId: string; + + /** + * Index of the coin in the refresh group. + */ + coinIndex: number; + /** * 512-bit secret that can be used to derive * the other cryptographic material for the refresh session. @@ -1021,6 +1023,8 @@ export interface RefreshSessionRecord { * The no-reveal-index after we've done the melting. */ norevealIndex?: number; + + lastError?: TalerErrorDetail; } export enum RefundReason { @@ -2372,6 +2376,13 @@ export const WalletStoresV1 = { byStatus: describeIndex("byStatus", "operationStatus"), }, ), + refreshSessions: describeStore( + "refreshSessions", + describeContents<RefreshSessionRecord>({ + keyPath: ["refreshGroupId", "coinIndex"], + }), + {}, + ), recoupGroups: describeStore( "recoupGroups", describeContents<RecoupGroupRecord>({ |