commit b398deb2539298ccfb798a6cefa2ae2ddc52a7fc
parent 358182c512f94961faadfde9911f2b7977bc8c29
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 2 May 2016 06:35:30 +0200
fixing #4462: avoid temporary schemata altogether
Diffstat:
5 files changed, 18 insertions(+), 39 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -93,11 +93,6 @@ char *TMH_merchant_currency_string;
static struct GNUNET_SCHEDULER_Task *mhd_task;
/**
- * Should we do a dry run where temporary tables are used for storing the data.
- */
-static int dry;
-
-/**
* Global return code
*/
static int result;
@@ -575,7 +570,7 @@ run (void *cls,
return;
}
if (GNUNET_OK !=
- db->initialize (db->cls, dry))
+ db->initialize (db->cls))
{
GNUNET_break (0);
GNUNET_SCHEDULER_shutdown ();
@@ -773,9 +768,6 @@ int
main (int argc, char *const *argv)
{
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'t', "temp", NULL,
- gettext_noop ("Use temporary database tables"), GNUNET_NO,
- &GNUNET_GETOPT_set_one, &dry},
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c
@@ -82,7 +82,7 @@ TMH_AUDITORS_check_dk (struct TALER_EXCHANGE_Handle *mh,
unsigned int i;
unsigned int j;
- if (0 == GNUNET_TIME_absolute_get_remaining (dk->deposit_valid_until).rel_value_us)
+ if (0 == GNUNET_TIME_absolute_get_remaining (dk->expire_deposit).rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Denomination key offered by client has expired for deposits\n");
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
@@ -51,37 +51,28 @@ struct PostgresClosure
* Initialize merchant tables
*
* @param cls closure our `struct Plugin`
- * @param tmp #GNUNET_YES if the tables are to be made temporary i.e. their
- * contents are dropped when the database connection is closed
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
static int
-postgres_initialize (void *cls,
- int tmp)
+postgres_initialize (void *cls)
{
struct PostgresClosure *pg = cls;
- const char *tmp_str = (1 == tmp) ? "TEMPORARY" : "";
- char *sql;
PGresult *res;
ExecStatusType status;
int ret;
- GNUNET_asprintf (&sql,
- "CREATE %1$s TABLE IF NOT EXISTS payments ("
- "h_contract BYTEA NOT NULL,"
- "h_wire BYTEA NOT NULL,"
- "transaction_id INT8," /*WARNING: this column used to be primary key, but that wrong since multiple coins belong to the same id*/
- "timestamp INT8 NOT NULL,"
- "refund_deadline INT8 NOT NULL,"
- "amount_without_fee_val INT8 NOT NULL,"
- "amount_without_fee_frac INT4 NOT NULL,"
- "amount_without_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL,"
- "coin_pub BYTEA NOT NULL,"
- "exchange_proof BYTEA NOT NULL);",
- tmp_str);
ret = GNUNET_POSTGRES_exec (pg->conn,
- sql);
- GNUNET_free (sql);
+ "CREATE TABLE IF NOT EXISTS payments ("
+ "h_contract BYTEA NOT NULL,"
+ "h_wire BYTEA NOT NULL,"
+ "transaction_id INT8," /*WARNING: this column used to be primary key, but that wrong since multiple coins belong to the same id*/
+ "timestamp INT8 NOT NULL,"
+ "refund_deadline INT8 NOT NULL,"
+ "amount_without_fee_val INT8 NOT NULL,"
+ "amount_without_fee_frac INT4 NOT NULL,"
+ "amount_without_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL,"
+ "coin_pub BYTEA NOT NULL,"
+ "exchange_proof BYTEA NOT NULL);");
if (GNUNET_OK != ret)
return ret;
if ( (NULL == (res = PQprepare (pg->conn,
@@ -211,9 +202,8 @@ postgres_store_payment (void *cls,
*
* @param cls our plugin handle
* @param transaction_id the transaction id to search into
- * the db
- *
- * @return GNUNET_OK if found, GNUNET_NO if not, GNUNET_SYSERR
+ * the db
+ * @return #GNUNET_OK if found, #GNUNET_NO if not, #GNUNET_SYSERR
* upon error
*/
static int
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
@@ -59,7 +59,7 @@ run (void *cls)
json_t *exchange_proof = NULL;
FAILIF (NULL == (plugin = TALER_MERCHANTDB_plugin_load (cfg)));
- FAILIF (GNUNET_OK != plugin->initialize (plugin->cls, GNUNET_YES));
+ FAILIF (GNUNET_OK != plugin->initialize (plugin->cls));
/* Prepare data for 'store_payment()' */
RND_BLK (&h_contract);
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
@@ -51,13 +51,10 @@ struct TALER_MERCHANTDB_Plugin
* Initialize merchant tables
*
* @param cls closure
- * @param tmp #GNUNET_YES if the tables are to be made temporary i.e. their
- * contents are dropped when the @a conn is closed
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
int
- (*initialize) (void *cls,
- int tmp);
+ (*initialize) (void *cls);
/**
* Insert payment confirmation from the exchange into the database.