From a261b98c73643a16e70ce4f22ed7cd8838967689 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 31 Dec 2021 21:04:08 +0100 Subject: default to account expiration minimum of 1 year --- src/stasis/plugin_anastasis_postgres.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/stasis') diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c index 6bb7f32..b2391f8 100644 --- a/src/stasis/plugin_anastasis_postgres.c +++ b/src/stasis/plugin_anastasis_postgres.c @@ -1051,7 +1051,8 @@ retry: /** - * Increment account lifetime. + * Increment account lifetime based on payment having been received. + * Does nothing if the payment is not new. * * @param cls closure * @param account_pub which account received a payment @@ -1071,6 +1072,11 @@ postgres_increment_lifetime ( struct PostgresClosure *pg = cls; enum GNUNET_DB_QueryStatus qs; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Incrementing lifetime of account %s based on payment by %s\n", + TALER_B2S (account_pub), + GNUNET_TIME_relative2s (lifetime, + true)); check_connection (pg); for (unsigned int retries = 0; retriesconn, "user_insert", params); @@ -1160,7 +1173,8 @@ postgres_increment_lifetime ( case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { - /* existing rec doc payment, return expiration */ + /* existing rec doc payment (payment replay), return + existing expiration */ *paid_until = expiration; rollback (pg); GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -1171,13 +1185,18 @@ postgres_increment_lifetime ( } else { - /* user exists, update expiration_date */ + /* user exists, payment is new, update expiration_date */ struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_timestamp (&expiration), GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_end }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Incrementing lifetime of account %s by %s\n", + TALER_B2S (account_pub), + GNUNET_TIME_relative2s (lifetime, + true)); expiration = GNUNET_TIME_absolute_to_timestamp ( GNUNET_TIME_absolute_add (expiration.abs_time, -- cgit v1.2.3