diff options
author | Florian Dold <florian@dold.me> | 2024-04-02 19:47:38 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-04-02 19:47:38 +0200 |
commit | bfb20bef36e159a2a233d21c2c071162216373cc (patch) | |
tree | ea00b60242958fa8919158ff6f22896230bfb64e /packages/taler-wallet-core/src/refresh.ts | |
parent | c99b21725e3b6f3fd2bd2f103994a72e2e5977b4 (diff) | |
download | wallet-core-bfb20bef36e159a2a233d21c2c071162216373cc.tar.xz |
wallet-core: make refresh work again
Diffstat (limited to 'packages/taler-wallet-core/src/refresh.ts')
-rw-r--r-- | packages/taler-wallet-core/src/refresh.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts index 490b1b5f5..dbd81387b 100644 --- a/packages/taler-wallet-core/src/refresh.ts +++ b/packages/taler-wallet-core/src/refresh.ts @@ -989,12 +989,20 @@ async function refreshReveal( logger.warn("no refresh session found"); return; } + if (rg.statusPerCoin[coinIndex] !== RefreshCoinStatus.Pending) { + return; + } const rs = await tx.refreshSessions.get([refreshGroupId, coinIndex]); if (!rs) { return; } rg.statusPerCoin[coinIndex] = RefreshCoinStatus.Finished; for (const coin of coins) { + const existingCoin = await tx.coins.get(coin.coinPub); + if (existingCoin) { + continue; + } + await tx.coins.add(coin); const denomInfo = await getDenomInfo( wex, tx, @@ -1111,8 +1119,6 @@ export async function processRefreshGroup( ); rg.operationStatus = RefreshOperationStatus.Finished; } - } - if (allFinal) { await makeCoinsVisible(wex, tx, ctx.transactionId); await tx.refreshGroups.put(rg); const newTxState = computeRefreshTransactionState(rg); @@ -1120,9 +1126,8 @@ export async function processRefreshGroup( oldTxState, newTxState, }; - } else { - return undefined; } + return undefined; }, ); |