taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit d34f8e48da519f0e35ec33ee9fd4aba5d95e1667
parent d759c7e78a2bbf8c0cf191aab7f513353372baf9
Author: Florian Dold <florian@dold.me>
Date:   Mon, 19 Sep 2022 12:48:11 +0200

wallet-core: make coin availability accounting idempotent

Diffstat:
Mpackages/taler-wallet-core/src/operations/refresh.ts | 4+++-
Mpackages/taler-wallet-core/src/wallet.ts | 4++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts @@ -522,7 +522,9 @@ async function refreshReveal( refreshGroupId: string, coinIndex: number, ): Promise<void> { - logger.info("doing refresh reveal"); + logger.info( + `doing refresh reveal for ${refreshGroupId} (old coin ${coinIndex})`, + ); const d = await ws.db .mktx((x) => [x.refreshGroups, x.coins, x.denominations]) .runReadOnly(async (tx) => { diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts @@ -810,6 +810,10 @@ export async function makeCoinAvailable( }>, coinRecord: CoinRecord, ): Promise<void> { + const existingCoin = await tx.coins.get(coinRecord.coinPub); + if (existingCoin) { + return; + } const denom = await tx.denominations.get([ coinRecord.exchangeBaseUrl, coinRecord.denomPubHash,