commit 193eeea9f7a230f88a88d985b1ec30b0fca8a329
parent b681b9b9b2db0b49c47f8f3589a49c44a8c681ab
Author: Florian Dold <florian@dold.me>
Date: Wed, 17 Sep 2025 02:16:54 +0200
-missing test file
Diffstat:
1 file changed, 127 insertions(+), 0 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-denom-lost-complex.ts b/packages/taler-harness/src/integrationtests/test-denom-lost-complex.ts
@@ -0,0 +1,127 @@
+/*
+ This file is part of GNU Taler
+ (C) 2020 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Imports.
+ */
+import {
+ encodeCrock,
+ getRandomBytes,
+ j2s,
+ TalerWireGatewayHttpClient,
+ TransactionMajorState,
+} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WithdrawalGroupStatus } from "../../../taler-wallet-core/src/db.js";
+import { createSimpleTestkudosEnvironmentV3 } from "../harness/environments.js";
+import {
+ getTestHarnessPaytoForLabel,
+ GlobalTestState,
+} from "../harness/harness.js";
+
+/**
+ * Run test re-denominating a withdrawal group
+ * after the exchange loses its denomination private keys.
+ *
+ * This test is for a particularly complex scenario,
+ * where exchange doesn't offer any good denomination for a while.
+ */
+export async function runDenomLostComplexTest(t: GlobalTestState) {
+ // Set up test environment
+
+ const { walletClient, bankClient, exchangeBankAccount, exchange } =
+ await createSimpleTestkudosEnvironmentV3(t);
+
+ const acctName = "my-acct";
+ const myPayto = getTestHarnessPaytoForLabel(acctName);
+
+ await bankClient.registerAccountExtended({
+ name: acctName,
+ password: encodeCrock(getRandomBytes(32)),
+ username: acctName,
+ payto_uri: myPayto,
+ });
+
+ // Withdraw digital cash into the wallet.
+
+ const wres = await walletClient.call(
+ WalletApiOperation.AcceptManualWithdrawal,
+ {
+ exchangeBaseUrl: exchange.baseUrl,
+ amount: "TESTKUDOS:10",
+ },
+ );
+
+ {
+ const txns = await walletClient.call(
+ WalletApiOperation.GetTransactionsV2,
+ {},
+ );
+ console.log(`transactions at start: ${j2s(txns)}`);
+ }
+
+ const wireGatewayApiClient = new TalerWireGatewayHttpClient(
+ exchangeBankAccount.wireGatewayApiBaseUrl,
+ );
+
+ await exchange.stop();
+
+ await exchange.purgeSecmodKeys();
+
+ await exchange.start({
+ skipKeyup: true,
+ });
+
+ await wireGatewayApiClient.addIncoming({
+ auth: exchangeBankAccount.wireGatewayAuth,
+ body: {
+ amount: "TESTKUDOS:10",
+ debit_account: myPayto,
+ reserve_pub: wres.reservePub,
+ },
+ });
+
+ await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
+ transactionId: wres.transactionId,
+ txState: WithdrawalGroupStatus.PendingRedenominate,
+ });
+
+ // This time, start without skipping key update
+ await exchange.stop();
+ await exchange.start();
+
+ await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
+ transactionId: wres.transactionId,
+ txState: {
+ major: TransactionMajorState.Done,
+ },
+ });
+
+ const txns = await walletClient.call(
+ WalletApiOperation.GetTransactionsV2,
+ {},
+ );
+
+ console.log(`${j2s(txns)}`);
+
+ const bal = await walletClient.call(WalletApiOperation.GetBalanceDetail, {
+ currency: "TESTKUDOS",
+ });
+
+ console.log(`${j2s(bal)}`);
+}
+
+runDenomLostComplexTest.suites = ["wallet"];