gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -misc fixes


From: gnunet
Subject: [taler-exchange] branch master updated: -misc fixes
Date: Thu, 20 Jul 2023 02:16:03 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 59e057b9 -misc fixes
59e057b9 is described below

commit 59e057b93e65c73dc3cd57dcced563847d85ba77
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jul 20 02:15:58 2023 +0200

    -misc fixes
---
 src/auditor/generate-auditor-basedb.conf |  1 -
 src/auditor/generate-auditor-basedb.sh   |  7 +++++--
 src/auditor/test-auditor.sh              | 14 +++++---------
 src/lib/exchange_api_handle.c            | 11 +++++++----
 src/testing/taler-unified-setup.sh       | 33 ++++++++++++++++++++++----------
 5 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/src/auditor/generate-auditor-basedb.conf 
b/src/auditor/generate-auditor-basedb.conf
index 9cc329c8..985efdaa 100644
--- a/src/auditor/generate-auditor-basedb.conf
+++ b/src/auditor/generate-auditor-basedb.conf
@@ -3,7 +3,6 @@ TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
 TALER_CONFIG_HOME = $TALER_HOME/.config/taler/
 TALER_DATA_HOME = $TALER_HOME/.local/share/taler/
 TALER_HOME = ${PWD}/generate_auditordb_home/
-
 [taler]
 CURRENCY = TESTKUDOS
 CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
diff --git a/src/auditor/generate-auditor-basedb.sh 
b/src/auditor/generate-auditor-basedb.sh
index 6399d94b..55127fff 100755
--- a/src/auditor/generate-auditor-basedb.sh
+++ b/src/auditor/generate-auditor-basedb.sh
@@ -24,9 +24,9 @@ echo " FOUND"
 CONF="generate-auditor-basedb.conf"
 
 # reset database
-echo -n "Reset 'auditor-basedb' database ..."
+echo -n "Reset 'auditor-basedb' database at $PGHOST ..."
 dropdb "auditor-basedb" >/dev/null 2>/dev/null || true
-createdb "auditor-basedb" || exit_skip "Could not create database '$BASEDB'"
+createdb "auditor-basedb" || exit_skip "Could not create database '$BASEDB' at 
$PGHOST"
 echo " DONE"
 
 # Launch exchange, merchant and bank.
@@ -70,6 +70,9 @@ taler-wallet-cli \
   )" &> taler-wallet-cli.log
 echo " DONE"
 
+taler-wallet-cli --wallet-db="$WALLET_DB" run-until-done
+taler-wallet-cli --wallet-db="$WALLET_DB" advanced run-pending
+
 # Dump database
 mkdir -p "$(dirname "$BASEDB")"
 
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index a3992f79..fb350a79 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -472,7 +472,7 @@ function run_audit () {
 # Do a full reload of the (original) database
 function full_reload()
 {
-    echo -n "Doing full reload of the database ($BASEDB - $DB)... "
+    echo -n "Doing full reload of the database (loading ${BASEDB}.sql into $DB 
at $PGHOST)... "
     dropdb "$DB" 2> /dev/null || true
     createdb -T template0 "$DB" \
         || exit_skip "could not create database $DB (at $PGHOST)"
@@ -2341,19 +2341,15 @@ echo " DONE"
 PGHOST="$TMPDIR/sockets"
 export PGHOST
 
-# FIXME: here for testing, avoids generation skip.
-# Should probably introduce getopt to make this
-# possible via CLI.
-check_with_database "bar/${DB}"
-
-
-exit 0
-
 MYDIR="${MY_TMP_DIR}/basedb"
 mkdir -p "${MYDIR}"
 echo "Generating fresh database at $MYDIR"
 if faketime -f '-1 d' ./generate-auditor-basedb.sh "$MYDIR/$DB"
 then
+    echo -n "Reset 'auditor-basedb' database at $PGHOST ..."
+    dropdb "auditor-basedb" >/dev/null 2>/dev/null || true
+    createdb "auditor-basedb" || exit_skip "Could not create database 
'$BASEDB' at $PGHOST"
+    echo " DONE"
     check_with_database "$MYDIR/$DB"
     if [ "$fail" != "0" ]
     then
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 0ad2f7a3..016f7bf6 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -422,6 +422,7 @@ parse_json_auditor (struct 
TALER_EXCHANGE_AuditorInformation *auditor,
   const json_t *keys;
   json_t *key;
   unsigned int off;
+  unsigned int pos;
   const char *auditor_url;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_fixed_auto ("auditor_pub",
@@ -450,7 +451,7 @@ parse_json_auditor (struct 
TALER_EXCHANGE_AuditorInformation *auditor,
   auditor->denom_keys
     = GNUNET_new_array (json_array_size (keys),
                         struct TALER_EXCHANGE_AuditorDenominationInfo);
-
+  pos = 0;
   json_array_foreach (keys, off, key) {
     struct TALER_AuditorSignatureP auditor_sig;
     struct TALER_DenominationHashP denom_h;
@@ -509,10 +510,11 @@ parse_json_auditor (struct 
TALER_EXCHANGE_AuditorInformation *auditor,
         return GNUNET_SYSERR;
       }
     }
-    auditor->denom_keys[off].denom_key_offset = dk_off;
-    auditor->denom_keys[off].auditor_sig = auditor_sig;
+    auditor->denom_keys[pos].denom_key_offset = dk_off;
+    auditor->denom_keys[pos].auditor_sig = auditor_sig;
+    pos++;
   }
-  auditor->num_denom_keys = off;
+  auditor->num_denom_keys = pos;
   return GNUNET_OK;
 }
 
@@ -2042,6 +2044,7 @@ TALER_EXCHANGE_keys_to_json (const struct 
TALER_EXCHANGE_Keys *kd)
         &kd->denom_keys[adi->denom_key_offset];
       json_t *k;
 
+      GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys);
       if (GNUNET_TIME_timestamp_cmp (now,
                                      >,
                                      dk->expire_deposit))
diff --git a/src/testing/taler-unified-setup.sh 
b/src/testing/taler-unified-setup.sh
index 7a19091a..e1365913 100755
--- a/src/testing/taler-unified-setup.sh
+++ b/src/testing/taler-unified-setup.sh
@@ -191,15 +191,11 @@ then
     echo " FOUND"
 fi
 
-# FIXME-MS: when run twice using
-# taler-unified-setup.sh -c test_bank_api_nexus.conf -ns
-# libeufin fails with a 502 failure (sandbox happy, nexus dies) below.
-# Work-around is to delete the database every time. Very unclean. => needs a 
fix!
-rm -f *.sqlite3
-
 EXCHANGE_URL=$(taler-config -c "$CONF" -s "EXCHANGE" -o "BASE_URL")
 CURRENCY=$(taler-config -c "$CONF" -s "TALER" -o "CURRENCY")
 
+echo "Setting up for $CURRENCY at $EXCHANGE_URL"
+
 register_sandbox_account() {
     export LIBEUFIN_SANDBOX_USERNAME="$1"
     export LIBEUFIN_SANDBOX_PASSWORD="$2"
@@ -246,16 +242,25 @@ fi
 
 if [ "1" = "$START_SANDBOX" ]
 then
-    export LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s 
"libeufin-sandbox" -o "DB_CONNECTION")
-
+    #
+    LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s 
"libeufin-sandbox" -o "DB_CONNECTION")
+    if [ ! -z "$PGHOST" ]
+    then
+        EHOST=$(echo $PGHOST | sed -e "s/\//\\\\\//g")
+        LIBEUFIN_SANDBOX_DB_CONNECTION=$(echo $LIBEUFIN_SANDBOX_DB_CONNECTION 
| sed -e "s/\/var\/run\/postgresql/$EHOST/")
+        taler-config -c "$CONF" -s "libeufin-sandbox" -o "DB_CONNECTION" -V 
"$LIBEUFIN_SANDBOX_DB_CONNECTION"
+    fi
+    export LIBEUFIN_SANDBOX_DB_CONNECTION
     # Create the default demobank.
-    echo -n "Configuring sandbox "
+    echo -n "Configuring sandbox at ${LIBEUFIN_SANDBOX_DB_CONNECTION} "
+
     libeufin-sandbox config \
                      --currency "$CURRENCY" \
                      --users-debt-limit 99999999 \
                      --bank-debt-limit 99999999 \
        default &> libeufin-sandbox-config.log
     echo "DONE"
+    echo "sandbox uses DB at $LIBEUFIN_SANDBOX_DB_CONNECTION"
     echo -n "Launching sandbox ... "
     export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret"
     libeufin-sandbox serve \
@@ -337,7 +342,15 @@ then
 
     # Prepare Nexus, which is the side actually talking
     # to the exchange.
-    export LIBEUFIN_NEXUS_DB_CONNECTION=$(taler-config -c "$CONF" -s 
"libeufin-nexus" -o "DB_CONNECTION")
+    LIBEUFIN_NEXUS_DB_CONNECTION=$(taler-config -c "$CONF" -s "libeufin-nexus" 
-o "DB_CONNECTION")
+
+    if [ ! -z "$PGHOST" ]
+    then
+        EHOST=$(echo $PGHOST | sed -e "s/\//\\\\\//g")
+        LIBEUFIN_NEXUS_DB_CONNECTION=$(echo $LIBEUFIN_NEXUS_DB_CONNECTION | 
sed -e "s/\/var\/run\/postgresql/$EHOST/")
+        taler-config -c "$CONF" -s "libeufin-nexus" -o "DB_CONNECTION" -V 
"$LIBEUFIN_NEXUS_DB_CONNECTION"
+    fi
+    export LIBEUFIN_NEXUS_DB_CONNECTION
 
     # For convenience, username and password are
     # identical to those used at the Sandbox.

-- 
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]