gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 02/02: wallet-core: fixup for coin availability (vis


From: gnunet
Subject: [taler-wallet-core] 02/02: wallet-core: fixup for coin availability (visible coins)
Date: Wed, 28 Jun 2023 17:22:37 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

commit 93ab00e601878b91a315babd2a9b6ab5dca59e92
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jun 28 17:22:27 2023 +0200

    wallet-core: fixup for coin availability (visible coins)
---
 packages/taler-wallet-core/src/db.ts                | 15 ++++++++++++---
 packages/taler-wallet-core/src/operations/common.ts |  1 +
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 89bb8b053..c12d0f2f7 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -2152,10 +2152,8 @@ export interface CoinAvailabilityRecord {
    * 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;
+  visibleCoinCount: number;
 }
 
 export interface ContractTermsRecord {
@@ -2942,6 +2940,17 @@ export const walletDbFixups: FixupDescription[] = [
       });
     },
   },
+  {
+    name: "CoinAvailabilityRecord_visibleCoinCount_add",
+    async fn(tx): Promise<void> {
+      await tx.coinAvailability.iter().forEachAsync(async (r) => {
+        if (r.visibleCoinCount == null) {
+          r.visibleCoinCount = r.freshCoinCount;
+          await tx.coinAvailability.put(r);
+        }
+      });
+    },
+  },
 ];
 
 const logger = new Logger("db.ts");
diff --git a/packages/taler-wallet-core/src/operations/common.ts 
b/packages/taler-wallet-core/src/operations/common.ts
index 52e4c4b53..620054cae 100644
--- a/packages/taler-wallet-core/src/operations/common.ts
+++ b/packages/taler-wallet-core/src/operations/common.ts
@@ -147,6 +147,7 @@ export async function makeCoinAvailable(
       denomPubHash: denom.denomPubHash,
       exchangeBaseUrl: denom.exchangeBaseUrl,
       freshCoinCount: 0,
+      visibleCoinCount: 0,
     };
   }
   car.freshCoinCount++;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]