summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-26 15:55:34 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-26 15:55:34 +0100
commit57c90547840ea2a073c950116303c54f9ef976f1 (patch)
treef53201d87e614325654e8935177275d2c4159eca /src/exchangedb/plugin_exchangedb_postgres.c
parent32da8154275a200144406d819d8abb77cab6fe30 (diff)
downloadexchange-57c90547840ea2a073c950116303c54f9ef976f1.tar.gz
exchange-57c90547840ea2a073c950116303c54f9ef976f1.tar.bz2
exchange-57c90547840ea2a073c950116303c54f9ef976f1.zip
implement #6161
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 23e94787..4f49a219 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1555,6 +1555,13 @@ postgres_get_session (void *cls)
") VALUES "
"($1, $2);",
2),
+ /* used in #postgres_insert_signkey_revocation() */
+ GNUNET_PQ_make_prepare ("lookup_signkey_revocation",
+ "SELECT "
+ " master_sig"
+ " FROM signkey_revocations"
+ " WHERE exchange_pub=$1;",
+ 1),
/* used in #postgres_insert_signkey() */
GNUNET_PQ_make_prepare ("insert_signkey",
"INSERT INTO exchange_sign_keys "
@@ -8492,6 +8499,46 @@ postgres_insert_signkey_revocation (
/**
+ * Obtain information about a revoked online signing key.
+ *
+ * @param cls closure
+ * @param session a session (can be NULL)
+ * @param exchange_pub exchange online signing key
+ * @param[out] master_sig set to signature affirming the revocation (if revoked)
+ * @return transaction status code
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_lookup_signkey_revocation (
+ void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_ExchangePublicKeyP *exchange_pub,
+ struct TALER_MasterSignatureP *master_sig)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (exchange_pub),
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ TALER_PQ_result_spec_auto_from_type ("master_sig",
+ master_sig),
+ GNUNET_PQ_result_spec_end
+ };
+
+ (void) cls;
+ if (NULL == session)
+ session = postgres_get_session (pg);
+ if (NULL == session)
+ return GNUNET_DB_STATUS_HARD_ERROR;
+
+ return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
+ "lookup_signkey_revocation",
+ params,
+ rs);
+}
+
+
+/**
* Lookup information about current denomination key.
*
* @param cls closure