aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/refresh.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-19 12:42:47 -0300
committerSebastian <sebasjm@gmail.com>2023-04-19 12:42:47 -0300
commitd483a3f5574355ed9c43eb6ddea59e5734323cf0 (patch)
tree2f4e3830512b50808b396991791c3c8877e5676e /packages/taler-wallet-core/src/operations/refresh.ts
parent7330f0daf907133876baf8831c44ec34cec326e5 (diff)
downloadwallet-core-d483a3f5574355ed9c43eb6ddea59e5734323cf0.tar.xz
fix #7704
Diffstat (limited to 'packages/taler-wallet-core/src/operations/refresh.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 70f0579c0..3122c9685 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -86,7 +86,7 @@ import {
import { makeCoinAvailable } from "./common.js";
import { updateExchangeFromUrl } from "./exchanges.js";
import { selectWithdrawalDenominations } from "../util/coinSelection.js";
-import { isWithdrawableDenom } from "../index.js";
+import { isWithdrawableDenom, WalletConfig } from "../index.js";
const logger = new Logger("refresh.ts");
@@ -105,13 +105,18 @@ export function getTotalRefreshCost(
denoms: DenominationRecord[],
refreshedDenom: DenominationInfo,
amountLeft: AmountJson,
+ denomselAllowLate: boolean,
): AmountJson {
const withdrawAmount = Amounts.sub(
amountLeft,
refreshedDenom.feeRefresh,
).amount;
const denomMap = Object.fromEntries(denoms.map((x) => [x.denomPubHash, x]));
- const withdrawDenoms = selectWithdrawalDenominations(withdrawAmount, denoms);
+ const withdrawDenoms = selectWithdrawalDenominations(
+ withdrawAmount,
+ denoms,
+ denomselAllowLate,
+ );
const resultingAmount = Amounts.add(
Amounts.zeroOfCurrency(withdrawAmount.currency),
...withdrawDenoms.selectedDenoms.map(
@@ -232,6 +237,7 @@ async function refreshCreateSession(
const newCoinDenoms = selectWithdrawalDenominations(
availableAmount,
availableDenoms,
+ ws.config.testing.denomselAllowLate,
);
if (newCoinDenoms.selectedDenoms.length === 0) {
@@ -897,7 +903,7 @@ export async function createRefreshGroup(
const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl
.iter(exchangeBaseUrl)
.filter((x) => {
- return isWithdrawableDenom(x);
+ return isWithdrawableDenom(x, ws.config.testing.denomselAllowLate);
});
denomsPerExchange[exchangeBaseUrl] = allDenoms;
return allDenoms;
@@ -955,6 +961,7 @@ export async function createRefreshGroup(
denoms,
denom,
Amounts.parseOrThrow(refreshAmount),
+ ws.config.testing.denomselAllowLate,
);
const output = Amounts.sub(refreshAmount, cost).amount;
estimatedOutputPerCoin.push(output);