exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 911d5a6ef721bf0add074ebaefee49d35000591e
parent ee73b3a775c148e5d190ce0af5a9e8e0a7ecb470
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  3 Apr 2026 12:55:47 +0200

dead code elimination

Diffstat:
Msrc/exchange/taler-exchange-httpd_post-reserves-attest-RESERVE_PUB.c | 2+-
Msrc/exchange/taler-exchange-httpd_post-reveal-withdraw.c | 53++++++++++++++++++++++++++++++-----------------------
Msrc/include/taler/taler-exchange/get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.h | 124++-----------------------------------------------------------------------------
Msrc/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h | 4+++-
Msrc/include/taler/taler-exchange/post-reveal-melt.h | 5-----
Msrc/include/taler/taler-exchange/post-reveal-withdraw.h | 5-----
Msrc/lib/exchange_api_get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.c | 18++++++++----------
Msrc/lib/exchange_api_post-purses-PURSE_PUB-create.c | 4++--
8 files changed, 46 insertions(+), 169 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_post-reserves-attest-RESERVE_PUB.c b/src/exchange/taler-exchange-httpd_post-reserves-attest-RESERVE_PUB.c @@ -388,4 +388,4 @@ TEH_handler_reserves_attest (struct TEH_RequestContext *rc, } -/* end of taler-exchange-httpd_reserves_attest.c */ +/* end of taler-exchange-httpd_reserves_attest-RESERVE_PUB.c */ diff --git a/src/exchange/taler-exchange-httpd_post-reveal-withdraw.c b/src/exchange/taler-exchange-httpd_post-reveal-withdraw.c @@ -119,9 +119,10 @@ parse_withdraw_reveal_json ( NULL)) ) { GNUNET_break_op (0); - *mhd_ret = TALER_MHD_reply_with_ec (connection, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - error); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + error); return GNUNET_SYSERR; } @@ -166,25 +167,28 @@ find_original_withdraw ( NULL); return GNUNET_SYSERR; case GNUNET_DB_STATUS_HARD_ERROR: - *result = TALER_MHD_reply_with_ec (connection, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "get_withdraw"); + *result = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "get_withdraw"); return GNUNET_SYSERR; case GNUNET_DB_STATUS_SOFT_ERROR: break; /* try again */ default: GNUNET_break (0); - *result = TALER_MHD_reply_with_ec (connection, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - NULL); + *result = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, + NULL); return GNUNET_SYSERR; } } /* after unsuccessful retries*/ GNUNET_break (0); - *result = TALER_MHD_reply_with_ec (connection, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "get_withdraw"); + *result = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "get_withdraw"); return GNUNET_SYSERR; } @@ -347,9 +351,10 @@ verify_commitment_and_max_age ( keys = TEH_keys_get_state (); if (NULL == keys) { - *result = TALER_MHD_reply_with_ec (con, - TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, - NULL); + *result = TALER_MHD_reply_with_error (con, + MHD_HTTP_SERVICE_UNAVAILABLE, + TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, + NULL); return GNUNET_SYSERR; } @@ -363,9 +368,10 @@ verify_commitment_and_max_age ( if (NULL == denom_keys[i]) { GNUNET_break_op (0); - *result = TALER_MHD_reply_with_ec (con, - TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, - NULL); + *result = TALER_MHD_reply_with_error (con, + MHD_HTTP_SERVICE_UNAVAILABLE, + TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, + NULL); return GNUNET_SYSERR; } @@ -512,9 +518,11 @@ verify_commitment_and_max_age ( &planchets_h.hash)) { GNUNET_break_op (0); - *result = TALER_MHD_reply_with_ec (con, - TALER_EC_EXCHANGE_WITHDRAW_REVEAL_INVALID_HASH, - NULL); + *result = TALER_MHD_reply_with_error ( + con, + MHD_HTTP_BAD_REQUEST, + TALER_EC_EXCHANGE_WITHDRAW_REVEAL_INVALID_HASH, + NULL); return GNUNET_SYSERR; } @@ -575,7 +583,6 @@ TEH_handler_reveal_withdraw ( }; (void) args; - /* Parse JSON body*/ ret = TALER_MHD_parse_json_data (rc->connection, root, spec); @@ -634,4 +641,4 @@ TEH_handler_reveal_withdraw ( } -/* end of taler-exchange-httpd_reveal_withdraw.c */ +/* end of taler-exchange-httpd_post-reveal-withdraw.c */ diff --git a/src/include/taler/taler-exchange/get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.h b/src/include/taler/taler-exchange/get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.h @@ -319,125 +319,5 @@ TALER_EXCHANGE_get_aml_attributes_cancel ( struct TALER_EXCHANGE_GetAmlAttributesHandle *aagh); -/* ******************** deprecated legay API ********************* */ - -/** - * Detailed KYC attribute data collected during a KYC process for the account. - */ -struct TALER_EXCHANGE_KycAttributeDetail -{ - /** - * Row of the attribute in the kyc_attributes table. - */ - uint64_t row_id; - - /** - * Name of the KYC provider that contributed the data. - */ - const char *provider_name; - - /** - * The collected KYC data. - */ - const json_t *attributes; - - /** - * When was the data collection made. - */ - struct GNUNET_TIME_Timestamp collection_time; - -}; - - -/** - * Information about KYC attributes returned by the exchange. - */ -struct TALER_EXCHANGE_KycAttributesResponse -{ - /** - * HTTP response details. - */ - struct TALER_EXCHANGE_HttpResponse hr; - - /** - * Details depending on the HTTP response code. - */ - union - { - - /** - * Information returned on success (#MHD_HTTP_OK). - */ - struct - { - - /** - * Array of KYC attribute data returned by the exchange. - */ - const struct TALER_EXCHANGE_KycAttributeDetail *kyc_attributes; - - /** - * Length of the @e kyc_attributes array. - */ - unsigned int kyc_attributes_length; - - } ok; - - } details; -}; - - -/** - * Function called with information about KYC attributes. - * - * @param cls closure - * @param kar response data - */ -typedef void -(*TALER_EXCHANGE_LookupKycAttributesCallback) ( - void *cls, - const struct TALER_EXCHANGE_KycAttributesResponse *kar); - - -/** - * @brief Handle for a GET /aml/$OFFICER_PUB/attributes/$H_PAYTO request. - */ -struct TALER_EXCHANGE_LookupKycAttributes; - - -/** - * Endpoint for the AML SPA to lookup KYC attribute data of a given account. - * - * @param ctx the context - * @param exchange_url HTTP base URL for the exchange - * @param h_payto which account to return the decision history for - * @param offset row number starting point (exclusive rowid) - * @param limit number of records to return, negative for descending, positive for ascending from start - * @param officer_priv private key of the deciding AML officer - * @param cb function to call with the exchange's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_EXCHANGE_LookupKycAttributes * -TALER_EXCHANGE_lookup_kyc_attributes ( - struct GNUNET_CURL_Context *ctx, - const char *exchange_url, - const struct TALER_NormalizedPaytoHashP *h_payto, - uint64_t offset, - int64_t limit, - const struct TALER_AmlOfficerPrivateKeyP *officer_priv, - TALER_EXCHANGE_LookupKycAttributesCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_EXCHANGE_lookup_kyc_attributes() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_EXCHANGE_lookup_kyc_attributes_cancel ( - struct TALER_EXCHANGE_LookupKycAttributes *rh); - -#endif \ - /* _TALER_EXCHANGE__GET_AML_OFFICER_PUB_ATTRIBUTES_H_NORMALIZED_PAYTO_H */ +#endif +/* _TALER_EXCHANGE__GET_AML_OFFICER_PUB_ATTRIBUTES_H_NORMALIZED_PAYTO_H */ diff --git a/src/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h b/src/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h @@ -74,7 +74,9 @@ struct TALER_EXCHANGE_PostPursesMergeResponse struct TALER_EXCHANGE_HttpResponse hr; /** - * Reserve signature affirming the merge. + * Reserve signature affirming the merge. This field is + * from the client's request and NOT from the server's + * response and returned here for convenience. */ const struct TALER_ReserveSignatureP *reserve_sig; diff --git a/src/include/taler/taler-exchange/post-reveal-melt.h b/src/include/taler/taler-exchange/post-reveal-melt.h @@ -233,11 +233,6 @@ struct TALER_EXCHANGE_PostRevealMeltResponse unsigned int num_coins; } ok; - /** - * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - */ - struct TALER_EXCHANGE_KycNeededRedirect unavailable_for_legal_reasons; - } details; }; diff --git a/src/include/taler/taler-exchange/post-reveal-withdraw.h b/src/include/taler/taler-exchange/post-reveal-withdraw.h @@ -92,11 +92,6 @@ struct TALER_EXCHANGE_PostRevealWithdrawResponse } ok; - /** - * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - */ - struct TALER_EXCHANGE_KycNeededRedirect unavailable_for_legal_reasons; - } details; }; diff --git a/src/lib/exchange_api_get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.c b/src/lib/exchange_api_get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.c @@ -111,7 +111,7 @@ struct TALER_EXCHANGE_GetAmlAttributesHandle * @return #GNUNET_OK on success */ static enum GNUNET_GenericReturnValue -parse_attributes_new ( +parse_attributes ( const json_t *jdetails, struct TALER_EXCHANGE_GetAmlAttributesCollectionEvent *detail_ar) { @@ -126,10 +126,8 @@ parse_attributes_new ( struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint64 ("rowid", &detail->rowid), - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("by_aml_officer", - &by_aml_officer), - NULL), + GNUNET_JSON_spec_bool ("by_aml_officer", + &by_aml_officer), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_object_const ("attributes", &detail->attributes), @@ -164,7 +162,7 @@ parse_attributes_new ( * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ static enum GNUNET_GenericReturnValue -parse_get_aml_attributes_ok_new ( +parse_get_aml_attributes_ok ( struct TALER_EXCHANGE_GetAmlAttributesHandle *aagh, const json_t *json) { @@ -198,8 +196,8 @@ parse_get_aml_attributes_ok_new ( sizeof (details)); lr.details.ok.details = details; if (GNUNET_OK != - parse_attributes_new (jdetails, - details)) + parse_attributes (jdetails, + details)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -240,8 +238,8 @@ handle_get_aml_attributes_finished (void *cls, break; case MHD_HTTP_OK: if (GNUNET_OK != - parse_get_aml_attributes_ok_new (aagh, - j)) + parse_get_aml_attributes_ok (aagh, + j)) { GNUNET_break_op (0); lr.hr.http_status = 0; diff --git a/src/lib/exchange_api_post-purses-PURSE_PUB-create.c b/src/lib/exchange_api_post-purses-PURSE_PUB-create.c @@ -405,7 +405,7 @@ handle_purse_create_deposit_finished (void *cls, break; } } - /* fall-through */ + break; case TALER_EC_EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA: if (GNUNET_OK != TALER_EXCHANGE_check_purse_econtract_conflict_ ( @@ -426,7 +426,7 @@ handle_purse_create_deposit_finished (void *cls, GNUNET_break_op (0); dr.hr.http_status = 0; dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; - } + } /* switch on (ec) */ } break; case MHD_HTTP_GONE: