[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 02/11: -minor refactoring in age_withdraw-reveal
From: |
gnunet |
Subject: |
[taler-exchange] 02/11: -minor refactoring in age_withdraw-reveal |
Date: |
Mon, 13 Mar 2023 00:32:58 +0100 |
This is an automated email from the git hooks/post-receive script.
oec pushed a commit to branch master
in repository exchange.
commit 7521ff1cf4fe27b3b808f8026ce0f239d9cdc6c6
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Mon Mar 6 21:36:14 2023 +0100
-minor refactoring in age_withdraw-reveal
---
.../taler-exchange-httpd_age-withdraw_reveal.c | 55 +++++++++++++---------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
index 01e11fb4..cdb8115f 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
@@ -260,7 +260,7 @@ EXIT:
/**
* Check if the request belongs to an existing age-withdraw request.
- * If so, sets the age_withdraw object with the request data.
+ * If so, sets the commitment object with the request data.
* Otherwise, it queues an appropriate MHD response.
*
* @param connection The HTTP connection to the client
@@ -272,7 +272,7 @@ EXIT:
* GNUNET_SYSERROR if we did not find the request in the DB
*/
static enum GNUNET_GenericReturnValue
-retrieve_original_commitment (
+find_original_commitment (
struct MHD_Connection *connection,
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const struct TALER_ReservePublicKeyP *reserve_pub,
@@ -319,7 +319,15 @@ retrieve_original_commitment (
/**
- * TODO
+ * Check if the given denomination is still or already valid, has not been
+ * revoked and supports age restriction.
+ *
+ * @param connection HTTP-connection to the client
+ * @param ksh The handle to the current state of (denomination) keys in the
exchange
+ * @param denom_h Hash of the denomination key to check
+ * @param[out] dks On success, will contain the denomination key details
+ * @param[out] result On failure, an MHD-response will be qeued and result
will be set to accordingly
+ * @return true on success (denomination valid), false otherwise
*/
static bool
denomination_is_valid (
@@ -379,20 +387,21 @@ denomination_is_valid (
return false;
}
- /* Does the denomation support age restriction ? */
if (0 == dks->denom_pub.age_mask.bits)
{
+ /* This denomation does not support age restriction */
char msg[256] = {0};
GNUNET_snprintf (msg,
sizeof(msg),
"denomination %s does not support age restriction",
GNUNET_h2s (&denom_h->hash));
- *result = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
- msg);
- return GNUNET_SYSERR;
+ *result = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
+ msg);
+ return false;
}
return true;
@@ -415,7 +424,7 @@ denomination_is_valid (
* GNUNET_SYSERR otherwise
*/
static enum GNUNET_GenericReturnValue
-all_denominations_valid (
+are_denominations_valid (
struct MHD_Connection *connection,
uint32_t len,
const struct TALER_DenominationHashP *denoms_h,
@@ -544,24 +553,26 @@ TEH_handler_age_withdraw_reveal (
do {
/* Extract denominations, blinded and disclosed coins */
- if (GNUNET_OK != parse_age_withdraw_reveal_json (rc->connection,
- j_denoms_h,
- j_coin_evs,
- j_disclosed_coins,
- &actx,
- &result))
+ if (GNUNET_OK != parse_age_withdraw_reveal_json (
+ rc->connection,
+ j_denoms_h,
+ j_coin_evs,
+ j_disclosed_coins,
+ &actx,
+ &result))
break;
/* Find original commitment */
- if (GNUNET_OK != retrieve_original_commitment (rc->connection,
- &actx.ach,
- &actx.reserve_pub,
- &actx.commitment,
- &result))
+ if (GNUNET_OK != find_original_commitment (
+ rc->connection,
+ &actx.ach,
+ &actx.reserve_pub,
+ &actx.commitment,
+ &result))
break;
/* Ensure validity of denoms and the sum of amounts and fees */
- if (GNUNET_OK != all_denominations_valid (
+ if (GNUNET_OK != are_denominations_valid (
rc->connection,
actx.num_coins,
actx.denoms_h,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] branch master updated (ce71db2c -> 187ae6f8), gnunet, 2023/03/12
- [taler-exchange] 03/11: -simplify zero-check for age-commitment hash, gnunet, 2023/03/12
- [taler-exchange] 01/11: WiP: age-withdraw implementation, part 4/n, gnunet, 2023/03/12
- [taler-exchange] 02/11: -minor refactoring in age_withdraw-reveal,
gnunet <=
- [taler-exchange] 04/11: WiP: age-withdraw, cut out work up to verify_commitment_and_max_age, gnunet, 2023/03/12
- [taler-exchange] 05/11: simplify hash generation of age commitment, gnunet, 2023/03/12
- [taler-exchange] 08/11: -gana bump, gnunet, 2023/03/12
- [taler-exchange] 10/11: -gana bump, gnunet, 2023/03/12
- [taler-exchange] 06/11: Merge branch 'master' into age-withdraw, gnunet, 2023/03/12
- [taler-exchange] 07/11: WiP: age-withdraw, added TALER_age_restriction_commit_from_base, 6/n, gnunet, 2023/03/12
- [taler-exchange] 09/11: Merge branch 'master' into age-withdraw, gnunet, 2023/03/12
- [taler-exchange] 11/11: WIP: age-withdraw, continue verify_commitment_and_max_age, 7/n, gnunet, 2023/03/12