summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/Makefile.am.in15
-rwxr-xr-xcontrib/ci/ci.sh5
-rwxr-xr-xcontrib/ci/jobs/1-build/build.sh2
-rw-r--r--contrib/ci/jobs/1-build/config.ini2
-rw-r--r--contrib/ci/jobs/2-test/config.ini2
-rwxr-xr-xcontrib/ci/jobs/2-test/test.sh4
-rw-r--r--contrib/ci/jobs/3-docs/config.ini2
-rw-r--r--contrib/exchange-tos-v0.rst2
m---------contrib/gana0
-rwxr-xr-xcontrib/taler-terms-generator (renamed from contrib/taler-terms-generator.in)4
m---------contrib/wallet-core0
-rw-r--r--src/exchange/exchange.conf4
-rw-r--r--src/exchange/taler-exchange-httpd_config.h2
-rw-r--r--src/exchange/taler-exchange-httpd_db.c44
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c30
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h22
-rw-r--r--src/exchangedb/Makefile.am1
-rw-r--r--src/exchangedb/pg_get_signature_for_known_coin.c63
-rw-r--r--src/exchangedb/pg_get_signature_for_known_coin.h43
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c19
-rw-r--r--src/include/taler_crypto_lib.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h18
-rw-r--r--src/include/taler_json_lib.h6
-rw-r--r--src/include/taler_util.h2
-rw-r--r--src/json/Makefile.am2
-rw-r--r--src/json/json_helper.c10
-rw-r--r--src/lib/exchange_api_handle.c7
-rw-r--r--src/util/config.c2
-rw-r--r--src/util/merchant_signatures.c4
29 files changed, 258 insertions, 61 deletions
diff --git a/contrib/Makefile.am.in b/contrib/Makefile.am.in
index 57853e99e..73dee525b 100644
--- a/contrib/Makefile.am.in
+++ b/contrib/Makefile.am.in
@@ -35,22 +35,9 @@ bin_SCRIPTS = \
taler-bank-manage-testing
-edit_script = $(SED) -e 's,%termsdir%,$(termsdir),'g -e 's,%localedir%,$(localedir),'g $(NULL)
-taler-terms-generator: taler-terms-generator.in
- rm -f $@ $@.tmp && \
- $(edit_script) $< >$@.tmp && \
- chmod a-w+x $@.tmp && \
- mv $@.tmp $@
-
-CLEANFILES = \
- taler-terms-generator
-
EXTRA_DIST = \
locale/de/LC_MESSAGES/exchange-tos-v0.po \
- taler-bank-manage-testing \
- taler-terms-generator.in \
- taler-auditor-dbconfig \
- taler-exchange-dbconfig \
+ $(bin_SCRIPTS) \
gana-generate.sh \
gana/gnu-taler-error-codes/registry.rec \
gana/gnu-taler-error-codes/Makefile \
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh
index 47c7a211e..dd7277c01 100755
--- a/contrib/ci/ci.sh
+++ b/contrib/ci/ci.sh
@@ -1,9 +1,8 @@
#!/bin/bash
set -exvuo pipefail
-# Use podman if available, otherwise use docker.
-# Fails if neither is found in PATH
-OCI_RUNTIME=$(which podman || which docker)
+# Use podman, fails if it isn't found in PATH
+OCI_RUNTIME=$(which podman)
REPO_NAME=$(basename "${PWD}")
JOB_NAME="${1}"
JOB_CONTAINER=$((grep CONTAINER_NAME contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${REPO_NAME}")
diff --git a/contrib/ci/jobs/1-build/build.sh b/contrib/ci/jobs/1-build/build.sh
index 35faf0ac5..d3fcfab85 100755
--- a/contrib/ci/jobs/1-build/build.sh
+++ b/contrib/ci/jobs/1-build/build.sh
@@ -9,4 +9,6 @@ apt-get upgrade -yqq
--enable-logging=verbose \
--disable-doc
+nump=$(grep processor /proc/cpuinfo | wc -l)
+make -j$(( $nump / 2 ))
make
diff --git a/contrib/ci/jobs/1-build/config.ini b/contrib/ci/jobs/1-build/config.ini
new file mode 100644
index 000000000..c21915a0b
--- /dev/null
+++ b/contrib/ci/jobs/1-build/config.ini
@@ -0,0 +1,2 @@
+[build]
+CONTAINER_NAME = localhost/exchange
diff --git a/contrib/ci/jobs/2-test/config.ini b/contrib/ci/jobs/2-test/config.ini
index c5a77c031..49cc8ea8a 100644
--- a/contrib/ci/jobs/2-test/config.ini
+++ b/contrib/ci/jobs/2-test/config.ini
@@ -2,5 +2,5 @@
HALT_ON_FAILURE = False
WARN_ON_FAILURE = True
CONTAINER_BUILD = True
-CONTAINER_NAME = exchange
+CONTAINER_NAME = localhost/exchange
CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/2-test/test.sh b/contrib/ci/jobs/2-test/test.sh
index 4c4142309..3681f51cb 100755
--- a/contrib/ci/jobs/2-test/test.sh
+++ b/contrib/ci/jobs/2-test/test.sh
@@ -8,7 +8,9 @@ apt-get upgrade -yqq
./configure CFLAGS="-ggdb -O0" \
--enable-logging=verbose \
--disable-doc
-make
+
+nump=$(grep processor /proc/cpuinfo | wc -l)
+make -j$(( $nump / 2 ))
make install
sudo -u postgres /usr/lib/postgresql/15/bin/postgres -D /etc/postgresql/15/main -h localhost -p 5432 &
diff --git a/contrib/ci/jobs/3-docs/config.ini b/contrib/ci/jobs/3-docs/config.ini
index c5a77c031..49cc8ea8a 100644
--- a/contrib/ci/jobs/3-docs/config.ini
+++ b/contrib/ci/jobs/3-docs/config.ini
@@ -2,5 +2,5 @@
HALT_ON_FAILURE = False
WARN_ON_FAILURE = True
CONTAINER_BUILD = True
-CONTAINER_NAME = exchange
+CONTAINER_NAME = localhost/exchange
CONTAINER_ARCH = amd64
diff --git a/contrib/exchange-tos-v0.rst b/contrib/exchange-tos-v0.rst
index 0a61e756b..f1d7834ac 100644
--- a/contrib/exchange-tos-v0.rst
+++ b/contrib/exchange-tos-v0.rst
@@ -1,6 +1,6 @@
# Terms of Service
-## Last update: 14.12.2023
+### Last update: 20.12.2023
Welcome! Taler Systems SA (“we,” “our,” or “us”) provides a payment service
through our Internet presence (collectively the “Services”). Before using our
diff --git a/contrib/gana b/contrib/gana
-Subproject ec6c82120f0c3dca85429b86652fd25d3c25a88
+Subproject 91e5fd6edb1b3567fd151960059ffb911973a44
diff --git a/contrib/taler-terms-generator.in b/contrib/taler-terms-generator
index 04f7ec3e5..38ccd6cc1 100755
--- a/contrib/taler-terms-generator.in
+++ b/contrib/taler-terms-generator
@@ -98,8 +98,8 @@ function failcat ()
# defaults
AUTHOR="GNU Taler team"
VERSION="exchange-tos-v0"
-LOCALE_DIR="%localedir%"
-OUTPUT="%termsdir%"
+LOCALE_DIR=$(taler-config -s "LOCALEDIR" -f)
+OUTPUT=$(taler-config -s "TERMS_DIR" -f)
PAPER="a4"
COPYRIGHT="2014-2023 Taler Systems SA (GPLv3+ or GFDL 1.3+)"
diff --git a/contrib/wallet-core b/contrib/wallet-core
-Subproject ec95723a68d36620aa66109c329437612383830
+Subproject 0c211082e0b8372f8fa1cef8102e477c7363d9b
diff --git a/src/exchange/exchange.conf b/src/exchange/exchange.conf
index f7387ced3..40eeb5e13 100644
--- a/src/exchange/exchange.conf
+++ b/src/exchange/exchange.conf
@@ -126,13 +126,13 @@ WIREWATCH_IDLE_SLEEP_INTERVAL = 1 s
SIGNKEY_LEGAL_DURATION = 2 years
# Directory with our terms of service.
-TERMS_DIR = $DATADIR/terms/
+TERMS_DIR = $TALER_DATA_HOME/terms/
# Etag / filename for the terms of service.
TERMS_ETAG = exchange-tos-v0
# Directory with our privacy policy.
-PRIVACY_DIR = $DATADIR/terms/
+PRIVACY_DIR = $TALER_DATA_HOME/terms/
# Etag / filename for the privacy policy.
PRIVACY_ETAG = exchange-pp-v0
diff --git a/src/exchange/taler-exchange-httpd_config.h b/src/exchange/taler-exchange-httpd_config.h
index f3e67e371..362667aca 100644
--- a/src/exchange/taler-exchange-httpd_config.h
+++ b/src/exchange/taler-exchange-httpd_config.h
@@ -41,7 +41,7 @@
*
* Returned via both /config and /keys endpoints.
*/
-#define EXCHANGE_PROTOCOL_VERSION "17:1:0"
+#define EXCHANGE_PROTOCOL_VERSION "18:0:1"
/**
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 5be12a508..6fec3fee4 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -19,9 +19,11 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#include <gnunet/gnunet_db_lib.h>
#include <pthread.h>
#include <jansson.h>
#include <gnunet/gnunet_json_lib.h>
+#include "taler_error_codes.h"
#include "taler_exchangedb_plugin.h"
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
@@ -62,14 +64,40 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
case TALER_EXCHANGEDB_CKS_DENOM_CONFLICT:
- /* FIXME: insufficient_funds != denom conflict! See issue #7267, need new
- * strategy for evidence gathering */
- *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (
- connection,
- TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY,
- &h_denom_pub,
- &coin->coin_pub);
- return GNUNET_DB_STATUS_HARD_ERROR;
+ /* The exchange has a seen this coin before, but with a different denomination.
+ * Get the corresponding signature and sent it to the client as proof */
+ {
+ struct
+ {
+ struct TALER_DenominationPublicKey pub;
+ struct TALER_DenominationSignature sig;
+ } prev_denom = {0};
+
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ TEH_plugin->get_signature_for_known_coin (TEH_plugin->cls,
+ &coin->coin_pub,
+ &prev_denom.pub,
+ &prev_denom.sig))
+ {
+ /* There _should_ have been a result, because
+ * we ended here due to a conflict! */
+ GNUNET_break (0);
+ *mhd_ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+
+ *mhd_ret = TEH_RESPONSE_reply_coin_denomination_conflict (
+ connection,
+ TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY,
+ &coin->coin_pub,
+ &prev_denom.pub,
+ &prev_denom.sig);
+
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NULL:
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NON_NULL:
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_VALUE_DIFFERS:
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 2d8dede51..a6d2c7ffc 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -180,6 +180,29 @@ TEH_RESPONSE_reply_coin_insufficient_funds (
MHD_RESULT
+TEH_RESPONSE_reply_coin_denomination_conflict (
+ struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_DenominationPublicKey *prev_denom_pub,
+ const struct TALER_DenominationSignature *prev_denom_sig)
+{
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ TALER_ErrorCode_get_http_status_safe (ec),
+ TALER_JSON_pack_ec (ec),
+ GNUNET_JSON_pack_data_auto ("coin_pub",
+ coin_pub),
+ TALER_JSON_pack_denom_pub ("prev_denom_pub",
+ prev_denom_pub),
+ TALER_JSON_pack_denom_sig ("prev_denom_sig",
+ prev_denom_sig)
+ );
+
+}
+
+
+MHD_RESULT
TEH_RESPONSE_reply_coin_age_commitment_conflict (
struct MHD_Connection *connection,
enum TALER_ErrorCode ec,
@@ -188,7 +211,6 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment)
{
- const struct TALER_AgeCommitmentHash *hac = h_age_commitment;
const char *conflict_detail;
switch (status)
@@ -196,10 +218,10 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict (
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NULL:
conflict_detail = "expected NULL age commitment hash";
- hac = NULL;
+ h_age_commitment = NULL;
break;
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NON_NULL:
- conflict_detail = "unexpected NULL age commitment hash";
+ conflict_detail = "expected non-NULL age commitment hash";
break;
case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_VALUE_DIFFERS:
conflict_detail = "expected age commitment hash differs";
@@ -218,7 +240,7 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict (
h_denom_pub),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_data_auto ("expected_age_commitment_hash",
- hac)),
+ h_age_commitment)),
GNUNET_JSON_pack_string ("conflict_detail",
conflict_detail)
);
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index b10a72824..57aeefe42 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -162,6 +162,28 @@ TEH_RESPONSE_reply_coin_insufficient_funds (
/**
* Send proof that a request is invalid to client because of
+ * an conflict with the provided denomination (the exchange had seen
+ * this coin before, signed by a different denomination).
+ * This function will create a message with the denomination's public key
+ * that was seen before.
+ *
+ * @param connection connection to the client
+ * @param ec error code to return
+ * @param coin_pub the public key of the coin
+ * @param prev_denom_pub the denomination of the coin, as seen previously
+ * @param prev_denom_sig the signature with the denomination key over the coin
+ * @return MHD result code
+ */
+MHD_RESULT
+TEH_RESPONSE_reply_coin_denomination_conflict (
+ struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_DenominationPublicKey *prev_denom_pub,
+ const struct TALER_DenominationSignature *prev_denom_sig);
+
+/**
+ * Send proof that a request is invalid to client because of
* a conflicting value for the age commitment hash of a coin.
* This function will create a message with the conflicting
* hash value for the age commitment of the given coin.
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index 84bd53018..847f2d880 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -126,6 +126,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
pg_count_known_coins.h pg_count_known_coins.c \
pg_ensure_coin_known.h pg_ensure_coin_known.c \
pg_get_known_coin.h pg_get_known_coin.c \
+ pg_get_signature_for_known_coin.h pg_get_signature_for_known_coin.c \
pg_get_coin_denomination.h pg_get_coin_denomination.c \
pg_have_deposit2.h pg_have_deposit2.c \
pg_aggregate.h pg_aggregate.c \
diff --git a/src/exchangedb/pg_get_signature_for_known_coin.c b/src/exchangedb/pg_get_signature_for_known_coin.c
new file mode 100644
index 000000000..06074312f
--- /dev/null
+++ b/src/exchangedb/pg_get_signature_for_known_coin.c
@@ -0,0 +1,63 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ 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.
+
+ 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
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_get_signature_for_known_coin.c
+ * @brief Implementation of the get_signature_for_known_coin function for Postgres
+ * @author Özgür Kesim
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_get_signature_for_known_coin.h"
+#include "pg_helper.h"
+
+enum GNUNET_DB_QueryStatus
+TEH_PG_get_signature_for_known_coin (
+ void *cls,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ struct TALER_DenominationPublicKey *denom_pub,
+ struct TALER_DenominationSignature *denom_sig)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (coin_pub),
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ TALER_PQ_result_spec_denom_pub ("denom_pub",
+ denom_pub),
+ TALER_PQ_result_spec_denom_sig ("denom_sig",
+ denom_sig),
+ GNUNET_PQ_result_spec_end
+ };
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Getting denomination and signature for (potentially) known coin %s\n",
+ TALER_B2S (coin_pub));
+ PREPARE (pg,
+ "get_signature_for_known_coin",
+ "SELECT"
+ " denominations.denom_pub"
+ ",denom_sig"
+ " FROM known_coins"
+ " JOIN denominations USING (denominations_serial)"
+ " WHERE coin_pub=$1;");
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "get_signature_for_known_coin",
+ params,
+ rs);
+}
diff --git a/src/exchangedb/pg_get_signature_for_known_coin.h b/src/exchangedb/pg_get_signature_for_known_coin.h
new file mode 100644
index 000000000..ec389176b
--- /dev/null
+++ b/src/exchangedb/pg_get_signature_for_known_coin.h
@@ -0,0 +1,43 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ 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.
+
+ 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
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_get_signature_for_known_coin.h
+ * @brief implementation of the get_signature_for_known_coin function for Postgres
+ * @author Özgür Kesim
+ */
+#ifndef PG_GET_SIGNATURE_FOR_KNOWN_COIN_H
+#define PG_GET_SIGNATURE_FOR_KNOWN_COIN_H
+
+#include "taler_util.h"
+#include "taler_json_lib.h"
+#include "taler_exchangedb_plugin.h"
+/**
+ * Retrieve the denomination and the corresponding signature for a known coin.
+ *
+ * @param cls the plugin closure
+ * @param coin_pub the public key of the coin to search for
+ * @param[out] denom_pub the denomination of the public key, if coin was present
+ * @param[out] denom_sig the signature with the denomination key of the coin, if coin was present
+ * @return transaction status code
+ */
+enum GNUNET_DB_QueryStatus
+TEH_PG_get_signature_for_known_coin (
+ void *cls,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ struct TALER_DenominationPublicKey *denom_pub,
+ struct TALER_DenominationSignature *denom_sig);
+
+#endif
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 51dbea659..7d9044a1e 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -130,6 +130,7 @@
#include "pg_count_known_coins.h"
#include "pg_ensure_coin_known.h"
#include "pg_get_known_coin.h"
+#include "pg_get_signature_for_known_coin.h"
#include "pg_get_coin_denomination.h"
#include "pg_have_deposit2.h"
#include "pg_aggregate.h"
@@ -232,14 +233,14 @@
* @param conn SQL connection that was used
*/
#define BREAK_DB_ERR(result,conn) do { \
- GNUNET_break (0); \
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
- "Database failure: %s/%s/%s/%s/%s", \
- PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
- PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
- PQresultErrorMessage (result), \
- PQresStatus (PQresultStatus (result)), \
- PQerrorMessage (conn)); \
+ GNUNET_break (0); \
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
+ "Database failure: %s/%s/%s/%s/%s", \
+ PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
+ PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
+ PQresultErrorMessage (result), \
+ PQresStatus (PQresultStatus (result)), \
+ PQerrorMessage (conn)); \
} while (0)
@@ -601,6 +602,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &TEH_PG_ensure_coin_known;
plugin->get_known_coin
= &TEH_PG_get_known_coin;
+ plugin->get_signature_for_known_coin
+ = &TEH_PG_get_signature_for_known_coin;
plugin->get_coin_denomination
= &TEH_PG_get_coin_denomination;
plugin->have_deposit2
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 0b80ff071..fb9e32a21 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -5516,7 +5516,7 @@ void
TALER_merchant_pay_sign (
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantPrivateKeyP *merch_priv,
- struct GNUNET_CRYPTO_EddsaSignature *merch_sig);
+ struct TALER_MerchantSignatureP *merch_sig);
/**
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 596764b1c..25d3b17f9 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -4358,7 +4358,8 @@ struct TALER_EXCHANGEDB_Plugin
* Retrieve information about the given @a coin from the database.
*
* @param cls database connection plugin state
- * @param coin the coin that must be made known
+ * @param coin_pub the coin that must be made known
+ * @param[out] coin_info detailed information about the coin
* @return database transaction status, non-negative on success
*/
enum GNUNET_DB_QueryStatus
@@ -4366,6 +4367,21 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_CoinPublicInfo *coin_info);
+ /**
+ * Retrieve the signature and corresponding denomination for a given @a coin
+ * from the database
+ *
+ * @param cls database connection plugin state
+ * @param coin_pub the public key of the coin we search for
+ * @param[out] denom_pub the public key of the denomination that the coin was signed with
+ * @param[out] denom_sig the signature with the denomination's private key over the coin_pub
+ */
+ enum GNUNET_DB_QueryStatus
+ (*get_signature_for_known_coin) (
+ void *cls,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ struct TALER_DenominationPublicKey *denom_pub,
+ struct TALER_DenominationSignature *denom_sig);
/**
* Retrieve the denomination of a known coin.
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 51fd17dd0..38668fdcc 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -28,6 +28,10 @@
#include "taler_util.h"
#include "taler_error_codes.h"
+/**
+ * Version of this API, for compatibility tests.
+ */
+#define TALER_JSON_LIB_VERSION 0x00020000
/**
* Details about an encrypted contract.
@@ -234,12 +238,14 @@ TALER_JSON_spec_amount (const char *name,
* a currency specification.
*
* @param name name of the amount field in the JSON
+ * @param currency_code currency code to parse
* @param[out] r_cspec where the currency spec has to be written
* @return spec for parsing an amount
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_currency_specification (
const char *name,
+ const char *currency_code,
struct TALER_CurrencySpecification *r_cspec);
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 7c2cc6880..7d5542a1b 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -215,7 +215,7 @@ TALER_config_get_currency (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct TALER_CurrencySpecification
{
/**
- * Name of the currency.
+ * Currency code of the currency.
*/
char currency[TALER_CURRENCY_LEN];
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index 6bd5b464c..6886b285a 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -16,7 +16,7 @@ libtalerjson_la_SOURCES = \
json_pack.c \
json_wire.c
libtalerjson_la_LDFLAGS = \
- -version-info 1:0:1 \
+ -version-info 2:0:0 \
-no-undefined
libtalerjson_la_LIBADD = \
$(top_builddir)/src/util/libtalerutil.la \
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 450cc194c..b339ff682 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -162,15 +162,13 @@ parse_cspec (void *cls,
struct GNUNET_JSON_Specification *spec)
{
struct TALER_CurrencySpecification *r_cspec = spec->ptr;
+ const char *currency = spec->cls;
const char *name;
- const char *currency;
uint32_t fid;
uint32_t fnd;
uint32_t ftzd;
const json_t *map;
struct GNUNET_JSON_Specification gspec[] = {
- GNUNET_JSON_spec_string ("currency",
- &currency),
GNUNET_JSON_spec_string ("name",
&name),
GNUNET_JSON_spec_uint32 ("num_fractional_input_digits",
@@ -186,7 +184,6 @@ parse_cspec (void *cls,
const char *emsg;
unsigned int eline;
- (void) cls;
memset (r_cspec->currency,
0,
sizeof (r_cspec->currency));
@@ -257,15 +254,16 @@ clean_cspec (void *cls,
struct GNUNET_JSON_Specification
TALER_JSON_spec_currency_specification (
const char *name,
+ const char *currency,
struct TALER_CurrencySpecification *r_cspec)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_cspec,
.cleaner = &clean_cspec,
- .cls = NULL,
+ .cls = (void *) currency,
.field = name,
.ptr = r_cspec,
- .ptr_size = 0,
+ .ptr_size = sizeof (*r_cspec),
.size_ptr = NULL
};
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 4b0298744..ed491c8bc 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -850,9 +850,6 @@ decode_keys_json (const json_t *resp_obj,
GNUNET_JSON_spec_string (
"currency",
&currency),
- TALER_JSON_spec_currency_specification (
- "currency_specification",
- &key_data->cspec),
GNUNET_JSON_spec_string (
"asset_type",
&asset_type),
@@ -913,6 +910,10 @@ decode_keys_json (const json_t *resp_obj,
}
{
struct GNUNET_JSON_Specification sspec[] = {
+ TALER_JSON_spec_currency_specification (
+ "currency_specification",
+ currency,
+ &key_data->cspec),
TALER_JSON_spec_amount (
"stefan_abs",
currency,
diff --git a/src/util/config.c b/src/util/config.c
index 188969c6f..f5accaad8 100644
--- a/src/util/config.c
+++ b/src/util/config.c
@@ -477,6 +477,8 @@ TALER_CONFIG_currency_specs_to_json (const struct
return GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("name",
cspec->name),
+ /* 'currency' is deprecated as of exchange v18 and merchant v6;
+ remove this line once current-age > 6*/
GNUNET_JSON_pack_string ("currency",
cspec->currency),
GNUNET_JSON_pack_uint64 ("num_fractional_input_digits",
diff --git a/src/util/merchant_signatures.c b/src/util/merchant_signatures.c
index 36f96499c..35e0b0e07 100644
--- a/src/util/merchant_signatures.c
+++ b/src/util/merchant_signatures.c
@@ -277,7 +277,7 @@ void
TALER_merchant_pay_sign (
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantPrivateKeyP *merch_priv,
- struct GNUNET_CRYPTO_EddsaSignature *merch_sig)
+ struct TALER_MerchantSignatureP *merch_sig)
{
struct TALER_PaymentResponsePS mr = {
.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK),
@@ -287,7 +287,7 @@ TALER_merchant_pay_sign (
GNUNET_CRYPTO_eddsa_sign (&merch_priv->eddsa_priv,
&mr,
- merch_sig);
+ &merch_sig->eddsa_sig);
}