aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-10-04 16:10:35 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-10-04 16:10:35 +0200
commit9d6fba17b6231aeb2d741b74b6efe7ff8049364e (patch)
treec4a601cf6db37796627d069d768ecbf13a104ca9
parent862cb42ec7fa31f96b71ad4d53c25f8b77a6792a (diff)
stub for /history testing
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c6
-rw-r--r--src/lib/test_merchant_api.c28
2 files changed, 30 insertions, 4 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index fc57929f..4c672bd4 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -547,7 +547,7 @@ postgres_store_transfer_to_proof (void *cls,
*
* @param cls our plugin handle
* @param date limit to transactions' age
- * @param cb function to call with transaction data
+ * @param cb function to call with transaction data, can be NULL
* @param cb_cls closure for @a cb
* @return numer of found tuples, #GNUNET_SYSERR upon error
*/
@@ -576,10 +576,10 @@ postgres_find_transactions_by_date (void *cls,
PQclear (result);
return GNUNET_SYSERR;
}
- if (0 == (n = PQntuples (result)))
+ if (0 == (n = PQntuples (result)) || NULL == cb)
{
PQclear (result);
- return 0;
+ return n;
}
for (i = 0; i < n; i++)
{
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index dab8087b..747c2d74 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -165,7 +165,12 @@ enum OpCode
/**
* Retrieve wire transfer details for a given transaction
*/
- OC_TRACK_TRANSACTION
+ OC_TRACK_TRANSACTION,
+
+ /**
+ * Test getting transactions based on timestamp
+ */
+ OC_HISTORY
};
@@ -526,6 +531,27 @@ struct Command
} track_transaction;
+ struct {
+ /**
+ * Date we want retrieved transactions younger than
+ */
+ struct GNUNET_TIME_Absolute date;
+
+ /**
+ * How many "rows" we expect in the result
+ */
+ unsigned int nresult;
+
+ /**
+ * Handle to the merchant
+ */
+
+ /*TBD*/
+
+ } history;
+
+
+
} details;
};