summaryrefslogtreecommitdiff
path: root/src/types/dbTypes.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-15 16:59:00 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-15 16:59:00 +0100
commit4966376839365536923cd6cfbb86d15071432e1a (patch)
tree6658b4a84df5ba6a0189e6d79e37fb0cc7fb597a /src/types/dbTypes.ts
parentf4043a0f8114b1b8612e01a5cdf65b8d6ffc6f00 (diff)
downloadwallet-core-4966376839365536923cd6cfbb86d15071432e1a.tar.gz
wallet-core-4966376839365536923cd6cfbb86d15071432e1a.tar.bz2
wallet-core-4966376839365536923cd6cfbb86d15071432e1a.zip
group refresh sessions into groups for nicer history
Diffstat (limited to 'src/types/dbTypes.ts')
-rw-r--r--src/types/dbTypes.ts57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts
index 6a00a497d..c05aa68d7 100644
--- a/src/types/dbTypes.ts
+++ b/src/types/dbTypes.ts
@@ -41,6 +41,7 @@ import {
OperationError,
Duration,
getTimestampNow,
+ RefreshReason,
} from "./walletTypes";
export enum ReserveRecordStatus {
@@ -572,10 +573,6 @@ export enum CoinStatus {
*/
Fresh = "fresh",
/**
- * Used for a completed transaction and now dirty.
- */
- Dirty = "dirty",
- /**
* A coin that has been spent and refreshed.
*/
Dormant = "dormant",
@@ -849,6 +846,39 @@ export interface TipRecord {
retryInfo: RetryInfo;
}
+export interface RefreshGroupRecord {
+ /**
+ * Retry info, even present when the operation isn't active to allow indexing
+ * on the next retry timestamp.
+ */
+ retryInfo: RetryInfo;
+
+ lastError: OperationError | undefined;
+
+ lastErrorPerCoin: (OperationError | undefined)[];
+
+ refreshGroupId: string;
+
+ reason: RefreshReason;
+
+ oldCoinPubs: string[];
+
+ refreshSessionPerCoin: (RefreshSessionRecord | undefined)[];
+
+ /**
+ * Flag for each coin whether refreshing finished.
+ * If a coin can't be refreshed (remaining value too small),
+ * it will be marked as finished, but no refresh session will
+ * be created.
+ */
+ finishedPerCoin: boolean[];
+
+ /**
+ * Timestamp when the refresh session finished.
+ */
+ finishedTimestamp: Timestamp | undefined;
+}
+
/**
* Ongoing refresh
*/
@@ -913,30 +943,19 @@ export interface RefreshSessionRecord {
hash: string;
/**
- * Base URL for the exchange we're doing the refresh with.
- */
- exchangeBaseUrl: string;
-
- /**
* Timestamp when the refresh session finished.
*/
finishedTimestamp: Timestamp | undefined;
/**
- * A 32-byte base32-crockford encoded random identifier.
- */
- refreshSessionId: string;
-
- /**
* When has this refresh session been created?
*/
created: Timestamp;
/**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
+ * Base URL for the exchange we're doing the refresh with.
*/
- retryInfo: RetryInfo;
+ exchangeBaseUrl: string;
}
/**
@@ -1366,8 +1385,8 @@ export namespace Stores {
export const denominations = new DenominationsStore();
export const exchanges = new ExchangesStore();
export const proposals = new ProposalsStore();
- export const refresh = new Store<RefreshSessionRecord>("refresh", {
- keyPath: "refreshSessionId",
+ export const refreshGroups = new Store<RefreshGroupRecord>("refreshGroups", {
+ keyPath: "refreshGroupId",
});
export const reserves = new ReservesStore();
export const purchases = new PurchasesStore();