anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit 11209f481e3ded8d6803eeb6851be7b0344f2867
parent cd9ef9b8345e9485d6e40bad2785c7691f4d2ea0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 29 Jul 2026 18:46:26 +0200

populate the payment timestamp so a repeat payment request is sent

Diffstat:
Msrc/backend/anastasis-httpd_policy-upload.c | 7++++---
Msrc/include/anastasis/anastasis-database/get_recdoc_payment.h | 3++-
Msrc/stasis/get_recdoc_payment.c | 8+++++++-
Msrc/stasis/test_anastasis_db.c | 7+++++--
4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy-upload.c b/src/backend/anastasis-httpd_policy-upload.c @@ -364,7 +364,7 @@ proposal_cb (struct PolicyUploadContext *puc, "Storing payment request for order `%s'\n", por->details.ok.order_id); - qs = ANASTASIS_DB_insert_recdoc_payment ( + qs = ANASTASIS_DB_do_insert_recdoc_payment ( &puc->account, (uint32_t) AH_post_counter, &puc->payment_identifier, @@ -895,7 +895,8 @@ AH_handler_policy_post ( qs = ANASTASIS_DB_get_recdoc_payment ( &puc->payment_identifier, &paid, - &valid_counter); + &valid_counter, + &puc->existing_pi_timestamp); if (qs < 0) return TALER_MHD_reply_with_error (puc->con, MHD_HTTP_INTERNAL_SERVER_ERROR, @@ -940,7 +941,7 @@ AH_handler_policy_post ( /* Cost is zero, fake "zero" payment having happened */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Policy upload is free, allowing upload without payment\n"); - qs = ANASTASIS_DB_insert_recdoc_payment ( + qs = ANASTASIS_DB_do_insert_recdoc_payment ( account_pub, AH_post_counter, &puc->payment_identifier, diff --git a/src/include/anastasis/anastasis-database/get_recdoc_payment.h b/src/include/anastasis/anastasis-database/get_recdoc_payment.h @@ -39,6 +39,7 @@ enum GNUNET_DB_QueryStatus ANASTASIS_DB_get_recdoc_payment ( const struct ANASTASIS_PaymentSecretP *payment_secret, bool *paid, - bool *valid_counter); + bool *valid_counter, + struct GNUNET_TIME_Timestamp *creation_date); #endif diff --git a/src/stasis/get_recdoc_payment.c b/src/stasis/get_recdoc_payment.c @@ -33,23 +33,29 @@ * @param payment_secret payment secret which the user must provide with every upload * @param[out] paid bool value to show if payment is paid * @param[out] valid_counter bool value to show if post_counter is > 0 + * @param[out] creation_date when was the payment record created * @return transaction status */ enum GNUNET_DB_QueryStatus ANASTASIS_DB_get_recdoc_payment ( const struct ANASTASIS_PaymentSecretP *payment_secret, bool *paid, - bool *valid_counter) + bool *valid_counter, + struct GNUNET_TIME_Timestamp *creation_date) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (payment_secret), GNUNET_PQ_query_param_end }; + + *creation_date = GNUNET_TIME_UNIT_ZERO_TS; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_bool ("paid", paid), GNUNET_PQ_result_spec_bool ("valid_counter", valid_counter), + GNUNET_PQ_result_spec_timestamp ("creation_date", + creation_date), GNUNET_PQ_result_spec_end }; diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c @@ -71,6 +71,7 @@ run (void *cls) void *res_recovery_data = NULL; struct ANASTASIS_CRYPTO_EncryptedKeyShareP res_key_share; bool paid; + struct GNUNET_TIME_Timestamp pi_creation_date; bool valid_counter; uint32_t recversion = 1; unsigned char aes_gcm_tag[16]; @@ -135,7 +136,8 @@ run (void *cls) ANASTASIS_DB_get_recdoc_payment ( &paymentSecretP, &paid, - &valid_counter)); + &valid_counter, + &pi_creation_date)); memset (&accountPubP, 2, sizeof (accountPubP)); memset (&accountSig, 3, sizeof (accountSig)); @@ -182,7 +184,8 @@ run (void *cls) ANASTASIS_DB_get_recdoc_payment ( &paymentSecretP, &paid, - &valid_counter)); + &valid_counter, + &pi_creation_date)); FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != ANASTASIS_DB_get_challenge_payment ( &paymentSecretP,