diff options
author | Florian Dold <florian@dold.me> | 2023-06-28 17:22:27 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-06-28 17:22:33 +0200 |
commit | 93ab00e601878b91a315babd2a9b6ab5dca59e92 (patch) | |
tree | 96bb9438149802b2d9b50bc49b67f7bea99e1b4f /packages/taler-wallet-core/src/db.ts | |
parent | 3f4526847b76ddafa9a3e23d94e973c30d8c72ef (diff) | |
download | wallet-core-93ab00e601878b91a315babd2a9b6ab5dca59e92.tar.xz |
wallet-core: fixup for coin availability (visible coins)
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 15 |
1 files changed, 12 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"); |