summaryrefslogtreecommitdiff
path: root/src/stasis/plugin_anastasis_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-16 21:34:13 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-16 21:34:13 +0200
commit2a53e1758257b1af89e085511e4e7eba809ed84e (patch)
treeb3d1b995ab9d9a30452e2c12dd95d6b80e99b5f7 /src/stasis/plugin_anastasis_postgres.c
parentd94a0fe2f979348b45289b66b1cb5f72c3c3e76c (diff)
downloadanastasis-2a53e1758257b1af89e085511e4e7eba809ed84e.tar.gz
anastasis-2a53e1758257b1af89e085511e4e7eba809ed84e.tar.bz2
anastasis-2a53e1758257b1af89e085511e4e7eba809ed84e.zip
-modify backend to support new truth validation flow
Diffstat (limited to 'src/stasis/plugin_anastasis_postgres.c')
-rw-r--r--src/stasis/plugin_anastasis_postgres.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c
index 325bae8..4271f53 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -1915,11 +1915,9 @@ postgres_mark_challenge_code_satisfied (
const uint64_t code)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
GNUNET_PQ_query_param_uint64 (&code),
- GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
@@ -2544,6 +2542,19 @@ libanastasis_plugin_db_postgres_init (void *cls)
" AND expiration_date > $2"
" AND retry_counter > 0;",
2),
+ GNUNET_PQ_make_prepare ("challengecode_set_satisfied",
+ "UPDATE anastasis_challengecode"
+ " SET satisfied=TRUE"
+ " WHERE truth_uuid=$1"
+ " AND code=$2"
+ " AND creation_date IN"
+ " (SELECT creation_date"
+ " FROM anastasis_challengecode"
+ " WHERE truth_uuid=$1"
+ " AND code=$2"
+ " ORDER BY creation_date DESC"
+ " LIMIT 1);",
+ 2),
GNUNET_PQ_make_prepare ("challengecode_select_meta",
"SELECT "
" code"