diff options
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 15 | ||||
-rw-r--r-- | 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++; |