taler-typescript-core

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

commit fae7e033790d09aca85aeb1de53b2bdc73cb2d0b
parent ec7078d61bbed62fc62acff155ad80c8e7483beb
Author: Florian Dold <florian@dold.me>
Date:   Thu, 19 Mar 2026 21:46:02 +0100

-simplify

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-deposit-merge.ts | 10++++++++++
Mpackages/taler-wallet-core/src/deposits.ts | 25++++---------------------
2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-deposit-merge.ts b/packages/taler-harness/src/integrationtests/test-deposit-merge.ts @@ -57,6 +57,8 @@ export async function runDepositMergeTest(t: GlobalTestState) { const bal = await walletClient.call(WalletApiOperation.GetBalances, {}); t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:49.83"); + t.logStep("before first deposit"); + /** * first deposit */ @@ -97,6 +99,8 @@ export async function runDepositMergeTest(t: GlobalTestState) { d1Id = depositGroupResult.transactionId; } + t.logStep("after first deposit"); + await d1Track; await exchange.stop(); // @ts-ignore duration is not forever @@ -105,6 +109,8 @@ export async function runDepositMergeTest(t: GlobalTestState) { await exchange.pingUntilAvailable(); // total time: 1 minute + t.logStep("done with first timetravel"); + /** * second deposit after 1 minute */ @@ -145,7 +151,11 @@ export async function runDepositMergeTest(t: GlobalTestState) { d2Id = depositGroupResult.transactionId; } + t.logStep("done with second deposit"); + await d2Track; + + t.logStep("done with second deposit (track)"); await exchange.stop(); // @ts-ignore duration is not forever exchange.setTimetravel(Duration.fromSpec({ minutes: 2 }).d_ms); diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts @@ -2100,11 +2100,7 @@ export async function createDepositGroup( throw Error("deposit would exceed hard KYC limit"); } - // Heuristic for the merchant key pair: If there's an exchange where we made - // a withdrawal from, use that key pair, so the user doesn't have to do - // a KYC transfer to establish a kyc account key pair. - // FIXME: Extend the heuristic to use the last used merchant key pair? - let merchantPair: EddsaKeyPairStrings | undefined = undefined; + let merchantPair: EddsaKeyPairStrings; if (req.testingFixedPriv) { const merchantPub = await wex.cryptoApi.eddsaGetPublic({ priv: req.testingFixedPriv, @@ -2114,25 +2110,12 @@ export async function createDepositGroup( pub: merchantPub.pub, }; } else if (coins.length > 0) { - // FIXME: This is a bad/incomplete strategy to choose this key pair, - // as we need to filter for withdrawals from an actual bank account. - // Withdrawals from p2p reserves do not count/help. - // We should also consider using the key pair from the last successful - // deposit. - const res = await provideDepositAccountKeypair( + merchantPair = await provideDepositAccountKeypair( wex, coins[0].exchangeBaseUrl, ); - if (res) { - logger.info( - `reusing reserve pub ${res.pub} from last withdrawal to ${coins[0].exchangeBaseUrl}`, - ); - merchantPair = res; - } - } - if (!merchantPair) { - logger.info(`creating new merchant key pair for deposit`); - merchantPair = await wex.cryptoApi.createEddsaKeypair({}); + } else { + throw Error("refusing to create deposit with zero coins"); } const noncePair = await wex.cryptoApi.createEddsaKeypair({});