summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c14
-rw-r--r--src/backenddb/test_merchantdb.c4
2 files changed, 14 insertions, 4 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index a01357fb..6a2d891b 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -278,6 +278,13 @@ postgres_initialize (void *cls)
2);
PG_PREPARE (pg,
+ "find_contract",
+ "SELECT plain_contract FROM merchant_contract_maps"
+ " WHERE"
+ " h_contract=$1",
+ 1);
+
+ PG_PREPARE (pg,
"find_transactions_by_date",
"SELECT"
" transaction_id"
@@ -392,7 +399,7 @@ postgres_initialize (void *cls)
*/
static int
postgres_find_contract (void *cls,
- json_t *contract, /*Legal?*/
+ json_t *contract,
struct GNUNET_HashCode *h_contract)
{
struct PostgresClosure *pg = cls;
@@ -408,13 +415,16 @@ postgres_find_contract (void *cls,
"find_contract",
params);
i = PQntuples (result);
- if (1 > i)
+ if (1 < i)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Mupltiple contracts share the same hashcode.\n");
return GNUNET_SYSERR;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "i, %d\n", i);
+
if (0 == i)
return GNUNET_NO;
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 4e81dd98..f6f1ab42 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -363,8 +363,8 @@ run (void *cls)
FAILIF (GNUNET_OK !=
plugin->find_contract (plugin->cls,
- &contract,
- &out));
+ out,
+ &h_contract));
FAILIF (GNUNET_OK !=
plugin->store_transaction (plugin->cls,