summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-02-23 16:07:14 +0100
committerFlorian Dold <florian@dold.me>2023-02-23 16:07:14 +0100
commit582b6ae5f4139cd1be8096dd59371430455bbeef (patch)
treebe4a0f36e05726950f929e7a73b51cd1d3339b9a /packages/taler-wallet-core/src/db.ts
parentdd9e4555baf3b98478e9ad2b0edf81ea81add5e2 (diff)
downloadwallet-core-582b6ae5f4139cd1be8096dd59371430455bbeef.tar.gz
wallet-core-582b6ae5f4139cd1be8096dd59371430455bbeef.tar.bz2
wallet-core-582b6ae5f4139cd1be8096dd59371430455bbeef.zip
wallet-core: report correct amountEffective in peer-pull-credit even before withdrawal is active
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 630713ee3..a7bdda3ec 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1795,6 +1795,8 @@ export interface PeerPullPaymentInitiationRecord {
*/
amount: AmountString;
+ estimatedAmountEffective: AmountString;
+
/**
* Purse public key. Used as the primary key to look
* up this record.
@@ -2607,6 +2609,18 @@ export const walletDbFixups: FixupDescription[] = [
},
},
{
+ name: "PeerPullPaymentInitiationRecord_estimatedAmountEffective_add",
+ async fn(tx): Promise<void> {
+ await tx.peerPullPaymentInitiations.iter().forEachAsync(async (pi) => {
+ if (pi.estimatedAmountEffective) {
+ return;
+ }
+ pi.estimatedAmountEffective = pi.amount;
+ await tx.peerPullPaymentInitiations.put(pi);
+ });
+ },
+ },
+ {
name: "PeerPushPaymentInitiationRecord_ALL_removeLegacyTx",
async fn(tx): Promise<void> {
await tx.peerPushPaymentInitiations.iter().forEachAsync(async (pi) => {