[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: Worked on errors
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: Worked on errors |
Date: |
Fri, 08 Nov 2019 11:51:22 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new a2941b1 Worked on errors
a2941b1 is described below
commit a2941b1331da69a3e844f847de3228a37c69c559
Author: Dennis Neufeld <address@hidden>
AuthorDate: Fri Nov 8 10:42:58 2019 +0000
Worked on errors
---
src/include/anastasis_database_plugin.h | 17 +++-----
src/stasis/Makefile.am | 3 +-
src/stasis/plugin_anastasis_postgres.c | 15 +++----
src/stasis/test_anastasis_db.c | 70 +++++++++++++--------------------
4 files changed, 42 insertions(+), 63 deletions(-)
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index 843d324..e0dace0 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -25,6 +25,8 @@
#include <anastasis_error_codes.h>
#include <jansson.h>
#include <taler/taler_util.h>
+#include <uuid/uuid.h>
+
/**
* An EdDSA public key that is used to identify a user's account.
@@ -42,15 +44,6 @@ struct ANASTASIS_PaymentSecretP
uint32_t id[8];
};
-/**
- * UUID Identifier for a Truth document
- */
-struct ANASTASIS_uuid
-{
- char uuid[36];
-};
-
-
/**
* Handle to interact with the database.
*
@@ -236,7 +229,7 @@ struct ANASTASIS_DatabasePlugin
*/
enum ANASTASIS_DB_QueryStatus
(*store_truth)(void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
const void *truth_data,
size_t truth_data_size,
const char *mime_type,
@@ -255,7 +248,7 @@ struct ANASTASIS_DatabasePlugin
*/
enum ANASTASIS_DB_QueryStatus
(*get_escrow_challenge)(void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
void **truth,
size_t *truth_size,
char **truth_mime);
@@ -269,7 +262,7 @@ struct ANASTASIS_DatabasePlugin
*/
enum ANASTASIS_DB_QueryStatus
(*get_key_share)(void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
void **key_share,
size_t *key_share_size);
};
diff --git a/src/stasis/Makefile.am b/src/stasis/Makefile.am
index 9a47403..53f975b 100644
--- a/src/stasis/Makefile.am
+++ b/src/stasis/Makefile.am
@@ -52,7 +52,8 @@ test_anastasis_db_postgres_LDFLAGS = \
-lgnunetutil \
-lgnunetpq \
-ltalerutil \
- -ltalerpq
+ -ltalerpq \
+ -luuid
TESTS = \
test_anastasis_db-postgres
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index bf6fea6..97d80c0 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -27,6 +27,7 @@
#include "anastasis_database_plugin.h"
#include "anastasis_database_lib.h"
#include "anastasis_error_codes.h"
+#include <uuid/uuid.h>
/**
* How often do we re-try if we run into a DB serialization error?
@@ -287,7 +288,7 @@ postgres_store_recovery_document (void *cls,
}
// rollback if user hasn't paid
- if (GNUNET_TIME_round_rel (&time_remaining) == 0)
+ if (time_remaining.rel_value_us == 0)
{
rollback (pg);
return ANASTASIS_EC_DB_STATUS_PAYMENT_EXPIRED;
@@ -618,7 +619,7 @@ postgres_record_payment (void *cls,
*/
static enum ANASTASIS_DB_QueryStatus
postgres_store_truth (void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
const void *truth_data,
size_t truth_data_size,
const char *mime_type,
@@ -698,7 +699,7 @@ postgres_store_truth (void *cls,
*/
enum ANASTASIS_DB_QueryStatus
postgres_get_escrow_challenge (void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
void **truth,
size_t *truth_size,
char **truth_mime)
@@ -710,9 +711,9 @@ postgres_get_escrow_challenge (void *cls,
};
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_variable_size ("truth",
- truth,
- truth_size),
- GNUNET_PQ_result_spec_string ("truth_mime",
+ truth,
+ truth_size),
+ GNUNET_PQ_result_spec_string ("mime_type",
truth_mime),
GNUNET_PQ_result_spec_end
};
@@ -733,7 +734,7 @@ postgres_get_escrow_challenge (void *cls,
*/
enum ANASTASIS_DB_QueryStatus
postgres_get_key_share (void *cls,
- const struct ANASTASIS_uuid *uuid,
+ const uuid_t *uuid,
void **key_share,
size_t *key_share_size)
{
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 4be1da3..fc1189a 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -26,6 +26,7 @@
#include "anastasis_database_plugin.h"
#include "anastasis_database_lib.h"
#include "anastasis_error_codes.h"
+#include <uuid/uuid.h>
#define FAILIF(cond) \
@@ -54,11 +55,6 @@ static struct ANASTASIS_DatabasePlugin *plugin;
*/
static struct ANASTASIS_PaymentSecretP paymentSecretP;
-/**
- * UUID of the Truth to test, set to a UUID value
- */
-static struct ANASTASIS_uuid uuid;
-
/**
* User public key, set to a random value
*/
@@ -82,12 +78,7 @@ static void *recovery_data;
/**
* Recovery_data for the select test
*/
-static void **res_recovery_data;
-
-/**
- * Handle for the size of the recoverydata
- */
-static size_t *recoverydatasize;
+static void *res_recovery_data;
/**
* Truthdata which is stored into the Database, set to a random value
@@ -97,27 +88,17 @@ static void *truth_data;
/**
* Truth for the select test
*/
-static void **truth;
-
-/**
- * Handle for the size of the truth
- */
-static size_t *truthsize;
+static void *truth;
/**
* Keyshare which is stored into the Database, set to a random value
*/
static void *key_share;
-/**
- * Handle for the size of the keyshare
- */
-static size_t *keysharesize;
-
/**
* Keyshare for the select test
*/
-static void **res_key_share;
+static void *res_key_share;
/**
* Mime-type of truth
@@ -127,7 +108,7 @@ static char *mime_type;
/**
* Mime-type of truth for the select test
*/
-static char **res_mime_type;
+static char *res_mime_type;
/**
* Version of a Recoverydocument
@@ -170,7 +151,9 @@ run (void *cls)
}
uint32_t recversion = 1;
-
+ size_t truthsize;
+ size_t recoverydatasize;
+ size_t keysharesize;
RND_BLK (&accountPubP);
int rec_val = 100;
@@ -181,18 +164,19 @@ run (void *cls)
int truth_val = 300;
truth_data = &truth_val;
- RND_BLK (&truth_data);
+ RND_BLK (truth_data);
int key_val = 300;
key_share = &key_val;
- RND_BLK (&key_share);
+ RND_BLK (key_share);
post_counter = 2;
mime_type = "Picture";
TALER_string_to_amount ("EUR:30",&amount);
- uuid = (struct ANASTASIS_uuid) { "550e8400-e29b-11d4-a716-446655440000"};
+ uuid_t uuid;
+ uuid_generate(uuid);
struct GNUNET_TIME_Relative rel_time;
- rel_time = GNUNET_TIME_UNIT_SECONDS;
+ rel_time = GNUNET_TIME_UNIT_MONTHS;
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->record_payment (plugin->cls,
@@ -220,32 +204,32 @@ run (void *cls)
&paymentSecretP,
&version));
+ FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->get_latest_recovery_document (plugin->cls,
+ &accountPubP,
+ &recoverydatasize,
+ &res_recovery_data,
+ &res_version));
+
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_escrow_challenge (plugin->cls,
&uuid,
- truth,
- truthsize,
- res_mime_type));
+ &truth,
+ &truthsize,
+ &res_mime_type));
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_key_share (plugin->cls,
&uuid,
- res_key_share,
- keysharesize));
-
- FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->get_latest_recovery_document (plugin->cls,
- &accountPubP,
- recoverydatasize,
- res_recovery_data,
- &res_version));
+ &res_key_share,
+ &keysharesize));
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_recovery_document (plugin->cls,
&accountPubP,
recversion,
- recoverydatasize,
- res_recovery_data));
+ &recoverydatasize,
+ &res_recovery_data));
if (-1 == result)
result = 0;
--
To stop receiving notification emails like this one, please contact
address@hidden.