aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auditor/generate-auditor-basedb.conf1
-rwxr-xr-xsrc/auditor/generate-auditor-basedb.sh7
-rwxr-xr-xsrc/auditor/test-auditor.sh119
-rw-r--r--src/exchange/exchange.conf8
-rw-r--r--src/lib/exchange_api_handle.c11
-rwxr-xr-xsrc/testing/taler-unified-setup.sh33
6 files changed, 93 insertions, 86 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 6d46d8fd..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)"
@@ -1025,13 +1025,13 @@ function test_8() {
echo "===========8: wire-transfer-subject disagreement==========="
# Technically, this call shouldn't be needed, as libeufin should already be stopped here.
stop_libeufin
- OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}") \
+ OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}" -Aqt) \
|| exit_fail "Failed to SELECT FROM NexusBankTransactions nexus DB!"
- OLD_WTID=$(echo "SELECT reservePublicKey FROM TalerIncomingPayments WHERE payment='$OLD_ID';" \
- | pqsl "${DB}")
+ OLD_WTID=$(echo "SELECT \"reservePublicKey\" FROM TalerIncomingPayments WHERE payment='$OLD_ID';" \
+ | psql "${DB}" -Aqt)
NEW_WTID="CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG"
- echo "UPDATE TalerIncomingPayments SET reservePublicKey='$NEW_WTID' WHERE payment='$OLD_ID';" \
- | psql "${DB}" \
+ echo "UPDATE TalerIncomingPayments SET \"reservePublicKey\"='$NEW_WTID' WHERE payment='$OLD_ID';" \
+ | psql "${DB}" -q \
|| exit_fail "Failed to update TalerIncomingPayments"
run_audit
@@ -1043,9 +1043,9 @@ function test_8() {
exit_fail "Diagnostic wrong: $DIAG (0)"
fi
WTID=$(jq -r .reserve_in_amount_inconsistencies[0].reserve_pub < test-audit-wire.json)
- if [ "x$WTID" != x"$OLD_WTID" ] && [ "x$WTID" != "x$NEW_WTID" ]
+ if [ "$WTID" != "$OLD_WTID" ] && [ "$WTID" != "$NEW_WTID" ]
then
- exit_fail "WTID reported wrong: $WTID"
+ exit_fail "WTID reported wrong: $WTID (wanted $OLD_WTID or $NEW_WTID)"
fi
EX_A=$(jq -r .reserve_in_amount_inconsistencies[0].amount_exchange_expected < test-audit-wire.json)
if [ "$WTID" = "$OLD_WTID" ] && [ "$EX_A" != "TESTKUDOS:10" ]
@@ -1089,8 +1089,8 @@ function test_8() {
echo "PASS"
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET reservePublicKey='$OLD_WTID' WHERE payment='$OLD_ID';" \
- | psql "${DB}"
+ echo "UPDATE TalerIncomingPayments SET \"reservePublicKey\"='$OLD_WTID' WHERE payment='$OLD_ID';" \
+ | psql "${DB}" -q
}
@@ -1101,10 +1101,10 @@ function test_9() {
echo "===========9: wire-origin disagreement==========="
# Technically, this call shouldn't be needed, as libeufin should already be stopped here.
stop_libeufin
- OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}")
- OLD_ACC=$(echo "SELECT incomingPaytoUri FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | psql "${DB}")
- echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='payto://iban/SANDBOXX/DE144373?receiver-name=New+Exchange+Company' WHERE payment='$OLD_ID';" \
- | psql "${DB}"
+ OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}" -Aqt)
+ OLD_ACC=$(echo 'SELECT "incomingPaytoUri" FROM TalerIncomingPayments WHERE payment='"'$OLD_ID';" | psql "${DB}" -Aqt)
+ echo "UPDATE TalerIncomingPayments SET \"incomingPaytoUri\"='payto://iban/SANDBOXX/DE144373?receiver-name=New+Exchange+Company' WHERE payment='$OLD_ID';" \
+ | psql "${DB}" -q
run_audit
@@ -1122,8 +1122,8 @@ function test_9() {
echo PASS
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='$OLD_ACC' WHERE payment='$OLD_ID';" \
- | psql "${DB}"
+ echo "UPDATE TalerIncomingPayments SET \"incomingPaytoUri\"='$OLD_ACC' WHERE payment='$OLD_ID';" \
+ | psql "${DB}" -q
}
@@ -1134,9 +1134,9 @@ function test_10() {
echo "===========10: wire-timestamp disagreement==========="
# Technically, this call shouldn't be needed, as libeufin should already be stopped here.
stop_libeufin
- OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}")
- OLD_DATE=$(echo "SELECT timestampMs FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | psql "${DB}")
- echo "UPDATE TalerIncomingPayments SET timestampMs=$NOW_MS WHERE payment=$OLD_ID;" | psql "${DB}"
+ OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}" -Aqt)
+ OLD_DATE=$(echo "SELECT \"timestampMs\" FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | psql "${DB}" -Aqt)
+ echo "UPDATE TalerIncomingPayments SET \"timestampMs\"=$NOW_MS WHERE payment=$OLD_ID;" | psql "${DB}" -q
run_audit
@@ -1151,10 +1151,10 @@ function test_10() {
then
exit_fail "Reported table wrong: $TABLE"
fi
- echo PASS
+ echo "PASS"
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET timestampMs='$OLD_DATE' WHERE payment=$OLD_ID;" | psql "${DB}"
+ echo "UPDATE TalerIncomingPayments SET \"timestampMs\"='$OLD_DATE' WHERE payment=$OLD_ID;" | psql "${DB}" -q
}
@@ -1166,28 +1166,28 @@ function test_11() {
echo "===========11: spurious outgoing transfer ==========="
# Technically, this call shouldn't be needed, as libeufin should already be stopped here.
stop_libeufin
- OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}")
- OLD_TX=$(echo "SELECT transactionJson FROM NexusBankTransactions WHERE id='$OLD_ID';" | psql "${DB}")
+ OLD_ID=$(echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | psql "${DB}" -Aqt)
+ OLD_TX=$(echo "SELECT \"transactionJson\" FROM NexusBankTransactions WHERE id='$OLD_ID';" | psql "${DB}" -Aqt)
# Change wire transfer to be FROM the exchange (#2) to elsewhere!
# (Note: this change also causes a missing incoming wire transfer, but
# this test is only concerned about the outgoing wire transfer
# being detected as such, and we simply ignore the other
# errors being reported.)
- OTHER_IBAN=$(echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | psql "${DB}")
+ OTHER_IBAN=$(echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | psql "${DB}" -Aqt)
NEW_TX=$(echo "$OLD_TX" | jq .batches[0].batchTransactions[0].details.creditDebitIndicator='"DBIT"' | jq 'del(.batches[0].batchTransactions[0].details.debtor)' | jq 'del(.batches[0].batchTransactions[0].details.debtorAccount)' | jq 'del(.batches[0].batchTransactions[0].details.debtorAgent)' | jq '.batches[0].batchTransactions[0].details.creditor'='{"name": "Forty Two"}' | jq .batches[0].batchTransactions[0].details.creditorAccount='{"iban": "'"$OTHER_IBAN"'"}' | jq .batches[0].batchTransactions[0].details.creditorAgent='{"bic": "SANDBOXX"}' | jq .batches[0].batchTransactions[0].details.unstructuredRemittanceInformation='"CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/"')
- echo -e "UPDATE NexusBankTransactions SET transactionJson='""$NEW_TX""' WHERE id=$OLD_ID" \
- | psql "${DB}"
+ echo -e "UPDATE NexusBankTransactions SET \"transactionJson\"='""$NEW_TX""' WHERE id=$OLD_ID" \
+ | psql "${DB}" -q
# Now fake that the exchange prepared this payment (= it POSTed to /transfer)
# This step is necessary, because the TWG table that accounts for outgoing
# payments needs it. Worth noting here is the column 'rawConfirmation' that
# points to the transaction from the main Nexus ledger; without that column set,
# a prepared payment won't appear as actually outgoing.
- echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,1,1,10,'TESTKUDOS','NOTGIVEN','unused','unused','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/','""$OTHER_IBAN""','SANDBOXX','Forty Two','unused',1,$OLD_ID)" \
- | psql "${DB}"
+ echo -e "INSERT INTO PaymentInitiations (\"bankAccount\",\"preparationDate\",\"submissionDate\",sum,currency,\"endToEndId\",\"paymentInformationId\",\"instructionId\",subject,\"creditorIban\",\"creditorBic\",\"creditorName\",submitted,\"messageId\",\"rawConfirmation\") VALUES (1,1,1,10,'TESTKUDOS','NOTGIVEN','unused','unused','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/','""$OTHER_IBAN""','SANDBOXX','Forty Two',false,1,$OLD_ID)" \
+ | psql "${DB}" -q
# Now populate the TWG table that accounts for outgoing payments, in
# order to let /history/outgoing return one result.
- echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,1,'unused','TESTKUDOS:10','http://exchange.example.com/','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG','payto://iban/SANDBOXX/""$OTHER_IBAN""?receiver-name=Forty+Two')" \
- | psql "${DB}"
+ echo -e "INSERT INTO TalerRequestedPayments (facade,payment,\"requestUid\",amount,\"exchangeBaseUrl\",wtid,\"creditAccount\") VALUES (1,1,'unused','TESTKUDOS:10','http://exchange.example.com/','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG','payto://iban/SANDBOXX/""$OTHER_IBAN""?receiver-name=Forty+Two')" \
+ | psql "${DB}" -q
run_audit
@@ -1219,17 +1219,10 @@ function test_11() {
fi
echo "PASS"
- # Undo database modification
- echo -e "UPDATE NexusBankTransactions SET transactionJson='$OLD_TX' WHERE id=$OLD_ID;" \
- | psql "${DB}"
- # No other prepared payment should exist at this point,
- # so OK to remove the number 1.
- echo -e "DELETE FROM PaymentInitiations WHERE id=1" \
- | psql "${DB}"
- echo -e "DELETE FROM TalerRequestedPayments WHERE id=1" \
- | psql "${DB}"
+ full_reload
}
+
# Test for hanging/pending refresh.
function test_12() {
@@ -1366,10 +1359,10 @@ function test_16() {
pre_audit aggregator
stop_libeufin
- OLD_AMOUNT=$(echo "SELECT amount FROM TalerRequestedPayments WHERE id='1';" | psql "${DB}")
+ OLD_AMOUNT=$(echo "SELECT amount FROM TalerRequestedPayments WHERE id='1';" | psql "${DB}" -Aqt)
NEW_AMOUNT="TESTKUDOS:50"
echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" \
- | psql "${DB}"
+ | psql "${DB}" -q
launch_libeufin
audit_only
@@ -1401,7 +1394,7 @@ function test_16() {
echo "Second modification: wire nothing"
NEW_AMOUNT="TESTKUDOS:0"
echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" \
- | psql "${DB}"
+ | psql "${DB}" -q
launch_libeufin
audit_only
stop_libeufin
@@ -1446,13 +1439,13 @@ function test_17() {
pre_audit aggregator
stop_libeufin
OLD_ID=1
- OLD_PREP=$(echo "SELECT payment FROM TalerRequestedPayments WHERE id='${OLD_ID}';" | psql "${DB}")
- OLD_DATE=$(echo "SELECT preparationDate FROM PaymentInitiations WHERE id='${OLD_ID}';" | psql "${DB}")
+ OLD_PREP=$(echo "SELECT payment FROM TalerRequestedPayments WHERE id='${OLD_ID}';" | psql "${DB}" -Aqt)
+ OLD_DATE=$(echo "SELECT \"preparationDate\" FROM PaymentInitiations WHERE id='${OLD_ID}';" | psql "${DB}" -Aqt)
# Note: need - interval '1h' as "NOW()" may otherwise be exactly what is already in the DB
# (due to rounding, if this machine is fast...)
NOW_1HR=$(( $(date +%s) - 3600))
- echo "UPDATE PaymentInitiations SET preparationDate='$NOW_1HR' WHERE id='${OLD_PREP}';" \
- | psql "${DB}"
+ echo "UPDATE PaymentInitiations SET \"preparationDate\"='$NOW_1HR' WHERE id='${OLD_PREP}';" \
+ | psql "${DB}" -q
launch_libeufin
echo "DONE"
audit_only
@@ -1484,7 +1477,7 @@ function test_18() {
echo "===========18: emergency================="
echo "DELETE FROM exchange.reserves_out;" \
- | psql -Aqt "$DB"
+ | psql -Aqt "$DB" -q
run_audit
@@ -1624,7 +1617,7 @@ function test_21() {
# remove transaction from bank DB
# Currently emulating this (to be deleted):
echo "DELETE FROM TalerRequestedPayments WHERE amount='TESTKUDOS:${VAL_DELTA}'" \
- | psql "${DB}"
+ | psql "${DB}" -q
launch_libeufin
audit_only
post_audit
@@ -1805,7 +1798,7 @@ function test_25() {
# Drop refund, so coin history is bogus.
echo "DELETE FROM exchange.refunds WHERE refund_serial_id=1;" \
- | psql -Aqt "$DB"
+ | psql -At "$DB"
run_audit aggregator
@@ -1898,14 +1891,14 @@ function test_27() {
pre_audit aggregator
stop_libeufin
# Obtain data to duplicate.
- WTID=$(echo SELECT wtid FROM TalerRequestedPayments WHERE id=1 | psql "${DB}")
- OTHER_IBAN=$(echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | psql "${DB}")
+ WTID=$(echo SELECT wtid FROM TalerRequestedPayments WHERE id=1 | psql "${DB}" -Aqt)
+ OTHER_IBAN=$(echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | psql "${DB}" -Aqt)
# 'rawConfirmation' is set to 2 here, that doesn't
# point to any record. That's only needed to set a non null value.
- echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,$(date +%s),$(( $(date +%s) + 2)),10,'TESTKUDOS','NOTGIVEN','unused','unused','$WTID http://exchange.example.com/','$OTHER_IBAN','SANDBOXX','Forty Two','unused',1,2)" \
- | psql "${DB}"
- echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,2,'unused','TESTKUDOS:1','http://exchange.example.com/','$WTID','payto://iban/SANDBOXX/$OTHER_IBAN?receiver-name=Forty+Two')" \
- | psql "${DB}"
+ echo -e "INSERT INTO PaymentInitiations (\"bankAccount\",\"preparationDate\",\"submissionDate\",sum,currency,\"endToEndId\",\"paymentInformationId\",\"instructionId\",subject,\"creditorIban\",\"creditorBic\",\"creditorName\",submitted,\"messageId\",\"rawConfirmation\") VALUES (1,$(date +%s),$(( $(date +%s) + 2)),10,'TESTKUDOS','NOTGIVEN','unused','unused','$WTID http://exchange.example.com/','$OTHER_IBAN','SANDBOXX','Forty Two',false,1,2)" \
+ | psql "${DB}" -q
+ echo -e "INSERT INTO TalerRequestedPayments (facade,payment,\"requestUid\",amount,\"exchangeBaseUrl\",wtid,\"creditAccount\") VALUES (1,2,'unused','TESTKUDOS:1','http://exchange.example.com/','$WTID','payto://iban/SANDBOXX/$OTHER_IBAN?receiver-name=Forty+Two')" \
+ | psql "${DB}" -q
launch_libeufin
audit_only
post_audit
@@ -2069,8 +2062,8 @@ function test_32() {
echo "===========32: known_coins signature wrong w. aggregation================="
# Modify denom_sig, so it is wrong
- OLD_SIG=$(echo 'SELECT denom_sig FROM exchange.known_coins LIMIT 1;' | psql "$DB" -At)
- COIN_PUB=$(echo "SELECT coin_pub FROM exchange.known_coins WHERE denom_sig='$OLD_SIG';" | psql "$DB" -At)
+ OLD_SIG=$(echo 'SELECT denom_sig FROM exchange.known_coins LIMIT 1;' | psql "$DB" -Aqt)
+ COIN_PUB=$(echo "SELECT coin_pub FROM exchange.known_coins WHERE denom_sig='$OLD_SIG';" | psql "$DB" -Aqt)
# shellcheck disable=SC2028
echo "UPDATE exchange.known_coins SET denom_sig='\x0000000100000000287369672d76616c200a2028727361200a2020287320233542383731423743393036444643303442424430453039353246413642464132463537303139374131313437353746324632323332394644443146324643333445393939413336363430334233413133324444464239413833353833464536354442374335434445304441453035374438363336434541423834463843323843344446304144363030343430413038353435363039373833434431333239393736423642433437313041324632414132414435413833303432434346314139464635394244434346374436323238344143354544364131373739463430353032323241373838423837363535453434423145443831364244353638303232413123290a2020290a20290b' WHERE coin_pub='$COIN_PUB'" \
| psql -Aqt "$DB"
@@ -2348,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/exchange/exchange.conf b/src/exchange/exchange.conf
index 5d9cb8f2..da357f64 100644
--- a/src/exchange/exchange.conf
+++ b/src/exchange/exchange.conf
@@ -120,13 +120,13 @@ WIREWATCH_IDLE_SLEEP_INTERVAL = 1 s
SIGNKEY_LEGAL_DURATION = 2 years
# Directory with our terms of service.
-TERMS_DIR = $DATADIR/exchange/tos/
+TERMS_DIR = $DATADIR/terms/
# Etag / filename for the terms of service.
-TERMS_ETAG = tos-v0
+TERMS_ETAG = exchange-tos-v0
# Directory with our privacy policy.
-PRIVACY_DIR = $DATADIR/exchange/pp/
+PRIVACY_DIR = $DATADIR/terms/
# Etag / filename for the privacy policy.
-PRIVACY_ETAG = pp-v0
+PRIVACY_ETAG = exchange-pp-v0
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.