gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: harness: need to add exchange


From: gnunet
Subject: [taler-wallet-core] branch master updated: harness: need to add exchange before initiating peer-pull payment
Date: Mon, 09 Dec 2024 19:16:04 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new d1ca613fc harness: need to add exchange before initiating peer-pull 
payment
d1ca613fc is described below

commit d1ca613fc7a06d66d9c53277a30b15a16b5195b0
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Dec 9 19:15:59 2024 +0100

    harness: need to add exchange before initiating peer-pull payment
---
 .../src/integrationtests/test-peer-to-peer-pull.ts             |  5 ++++-
 packages/taler-wallet-core/src/exchanges.ts                    | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts 
b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
index 145cbcee6..331f35e6b 100644
--- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
+++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts
@@ -23,7 +23,6 @@ import {
   Duration,
   j2s,
   NotificationType,
-  ScopeType,
   TalerCorebankApiClient,
   TransactionMajorState,
   TransactionMinorState,
@@ -105,6 +104,10 @@ async function checkNormalPeerPull(
     ),
   );
 
+  await wallet1.call(WalletApiOperation.AddExchange, {
+    exchangeBaseUrl: exchange.baseUrl,
+  });
+
   const checkPullCreditResp1 = await wallet1.client.call(
     WalletApiOperation.CheckPeerPullCredit,
     {
diff --git a/packages/taler-wallet-core/src/exchanges.ts 
b/packages/taler-wallet-core/src/exchanges.ts
index bc47e1bc7..b9b5043cb 100644
--- a/packages/taler-wallet-core/src/exchanges.ts
+++ b/packages/taler-wallet-core/src/exchanges.ts
@@ -3653,6 +3653,13 @@ export async function getPreferredExchangeForCurrency(
   if (restrictScope) {
     checkLogicInvariant(restrictScope.currency === currency);
   }
+  if (logger.shouldLogTrace()) {
+    logger.trace(
+      `finding preferred exchange for currency ${currency}, scope ${j2s(
+        restrictScope,
+      )}`,
+    );
+  }
   // Find an exchange with the matching currency.
   // Prefer exchanges with the most recent withdrawal.
   const url = await wex.db.runReadOnlyTx(
@@ -3666,15 +3673,18 @@ export async function getPreferredExchangeForCurrency(
     },
     async (tx) => {
       const exchanges = await tx.exchanges.iter().toArray();
+      logger.trace(`have ${exchanges.length} exchanges`);
       let candidate = undefined;
       for (const e of exchanges) {
         if (e.detailsPointer?.currency !== currency) {
+          logger.trace("no details pointer");
           continue;
         }
         const inScope =
           !restrictScope ||
           (await checkExchangeInScopeTx(wex, tx, e.baseUrl, restrictScope));
         if (!inScope) {
+          logger.trace("not in scope");
           continue;
         }
         if (!candidate) {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]