aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 5f7a6a4c4..7e1906351 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1850,6 +1850,8 @@ export interface PeerPushPaymentIncomingRecord {
timestamp: TalerProtocolTimestamp;
+ estimatedAmountEffective: AmountString;
+
/**
* Hash of the contract terms. Also
* used to look up the contract terms in the DB.
@@ -1865,6 +1867,14 @@ export interface PeerPushPaymentIncomingRecord {
* Associated withdrawal group.
*/
withdrawalGroupId: string | undefined;
+
+ /**
+ * Currency of the peer push payment credit transaction.
+ *
+ * Mandatory in current schema version, optional for compatibility
+ * with older (ver_minor<4) DB versions.
+ */
+ currency: string | undefined;
}
export enum PeerPullPaymentIncomingStatus {
@@ -2567,6 +2577,25 @@ export const walletDbFixups: FixupDescription[] = [
});
},
},
+ {
+ name: "PeerPushPaymentIncomingRecord_totalCostEstimated_add",
+ async fn(tx): Promise<void> {
+ await tx.peerPushPaymentIncoming.iter().forEachAsync(async (pi) => {
+ if (pi.estimatedAmountEffective) {
+ return;
+ }
+ const contractTerms = await tx.contractTerms.get(pi.contractTermsHash);
+ if (!contractTerms) {
+ // Not sure what we can do here!
+ } else {
+ // Not really the cost, but a good substitute for older transactions
+ // that don't sture the effective cost of the transaction.
+ pi.estimatedAmountEffective = contractTerms.contractTermsRaw.amount;
+ await tx.peerPushPaymentIncoming.put(pi);
+ }
+ });
+ },
+ },
];
const logger = new Logger("db.ts");