renaming /withdraw to /reserve (#3968)

This commit is contained in:
Christian Grothoff 2015-09-19 22:08:49 +02:00
parent cc47c5c701
commit 1eadd66ae0
18 changed files with 286 additions and 281 deletions

View File

@ -547,13 +547,13 @@ void
TALER_MINT_deposit_cancel (struct TALER_MINT_DepositHandle *deposit); TALER_MINT_deposit_cancel (struct TALER_MINT_DepositHandle *deposit);
/* ********************* /withdraw/status *********************** */ /* ********************* /reserve/status *********************** */
/** /**
* @brief A /withdraw/status Handle * @brief A /reserve/status Handle
*/ */
struct TALER_MINT_WithdrawStatusHandle; struct TALER_MINT_ReserveStatusHandle;
/** /**
@ -623,12 +623,12 @@ struct TALER_MINT_ReserveHistory
* @param history detailed transaction history, NULL on error * @param history detailed transaction history, NULL on error
*/ */
typedef void typedef void
(*TALER_MINT_WithdrawStatusResultCallback) (void *cls, (*TALER_MINT_ReserveStatusResultCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
json_t *json, json_t *json,
const struct TALER_Amount *balance, const struct TALER_Amount *balance,
unsigned int history_length, unsigned int history_length,
const struct TALER_MINT_ReserveHistory *history); const struct TALER_MINT_ReserveHistory *history);
/** /**
@ -647,11 +647,11 @@ typedef void
* @return a handle for this request; NULL if the inputs are invalid (i.e. * @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not called. * signatures fail to verify). In this case, the callback is not called.
*/ */
struct TALER_MINT_WithdrawStatusHandle * struct TALER_MINT_ReserveStatusHandle *
TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint, TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
TALER_MINT_WithdrawStatusResultCallback cb, TALER_MINT_ReserveStatusResultCallback cb,
void *cb_cls); void *cb_cls);
/** /**
@ -661,16 +661,16 @@ TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint,
* @param wsh the withdraw status request handle * @param wsh the withdraw status request handle
*/ */
void void
TALER_MINT_withdraw_status_cancel (struct TALER_MINT_WithdrawStatusHandle *wsh); TALER_MINT_reserve_status_cancel (struct TALER_MINT_ReserveStatusHandle *wsh);
/* ********************* /withdraw/sign *********************** */ /* ********************* /reserve/withdraw *********************** */
/** /**
* @brief A /withdraw/sign Handle * @brief A /reserve/withdraw Handle
*/ */
struct TALER_MINT_WithdrawSignHandle; struct TALER_MINT_ReserveWithdrawHandle;
/** /**
@ -684,14 +684,14 @@ struct TALER_MINT_WithdrawSignHandle;
* @param full_response full response from the mint (for logging, in case of errors) * @param full_response full response from the mint (for logging, in case of errors)
*/ */
typedef void typedef void
(*TALER_MINT_WithdrawSignResultCallback) (void *cls, (*TALER_MINT_ReserveWithdrawResultCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_DenominationSignature *sig, const struct TALER_DenominationSignature *sig,
json_t *full_response); json_t *full_response);
/** /**
* Withdraw a coin from the mint using a /withdraw/sign request. This * Withdraw a coin from the mint using a /reserve/withdraw request. This
* API is typically used by a wallet. Note that to ensure that no * API is typically used by a wallet. Note that to ensure that no
* money is lost in case of hardware failures, the caller must have * money is lost in case of hardware failures, the caller must have
* committed (most of) the arguments to disk before calling, and be * committed (most of) the arguments to disk before calling, and be
@ -711,14 +711,14 @@ typedef void
* if the inputs are invalid (i.e. denomination key not with this mint). * if the inputs are invalid (i.e. denomination key not with this mint).
* In this case, the callback is not called. * In this case, the callback is not called.
*/ */
struct TALER_MINT_WithdrawSignHandle * struct TALER_MINT_ReserveWithdrawHandle *
TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint, TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
const struct TALER_MINT_DenomPublicKey *pk, const struct TALER_MINT_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePrivateKeyP *reserve_priv,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_DenominationBlindingKey *blinding_key, const struct TALER_DenominationBlindingKey *blinding_key,
TALER_MINT_WithdrawSignResultCallback res_cb, TALER_MINT_ReserveWithdrawResultCallback res_cb,
void *res_cb_cls); void *res_cb_cls);
/** /**
@ -728,7 +728,7 @@ TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint,
* @param sign the withdraw sign request handle * @param sign the withdraw sign request handle
*/ */
void void
TALER_MINT_withdraw_sign_cancel (struct TALER_MINT_WithdrawSignHandle *sign); TALER_MINT_reserve_withdraw_cancel (struct TALER_MINT_ReserveWithdrawHandle *sign);
/* ********************* /refresh/melt+reveal ***************************** */ /* ********************* /refresh/melt+reveal ***************************** */

View File

@ -22,8 +22,8 @@ libtalermint_la_SOURCES = \
mint_api_deposit.c \ mint_api_deposit.c \
mint_api_refresh.c \ mint_api_refresh.c \
mint_api_refresh_link.c \ mint_api_refresh_link.c \
mint_api_wire.c \ mint_api_reserve.c \
mint_api_withdraw.c mint_api_wire.c
libtalermint_la_LIBADD = \ libtalermint_la_LIBADD = \
-lgnunetutil \ -lgnunetutil \

View File

@ -686,7 +686,7 @@ MAH_handle_is_ready (struct TALER_MINT_Handle *h)
* Obtain the URL to use for an API request. * Obtain the URL to use for an API request.
* *
* @param h the mint handle to query * @param h the mint handle to query
* @param path Taler API path (i.e. "/withdraw/sign") * @param path Taler API path (i.e. "/reserve/withdraw")
* @return the full URI to use with cURL * @return the full URI to use with cURL
*/ */
char * char *

View File

@ -48,7 +48,7 @@ MAH_handle_is_ready (struct TALER_MINT_Handle *h);
* Obtain the URL to use for an API request. * Obtain the URL to use for an API request.
* *
* @param h the mint handle to query * @param h the mint handle to query
* @param path Taler API path (i.e. "/withdraw/sign") * @param path Taler API path (i.e. "/reserve/withdraw")
* @return the full URI to use with cURL * @return the full URI to use with cURL
*/ */
char * char *

View File

@ -15,8 +15,8 @@
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file mint-lib/mint_api_withdraw.c * @file mint-lib/mint_api_reserve.c
* @brief Implementation of the /withdraw requests of the mint's HTTP API * @brief Implementation of the /reserve requests of the mint's HTTP API
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#include "platform.h" #include "platform.h"
@ -31,12 +31,12 @@
#include "taler_signatures.h" #include "taler_signatures.h"
/* ********************** /withdraw/status ********************** */ /* ********************** /reserve/status ********************** */
/** /**
* @brief A Withdraw Status Handle * @brief A Withdraw Status Handle
*/ */
struct TALER_MINT_WithdrawStatusHandle struct TALER_MINT_ReserveStatusHandle
{ {
/** /**
@ -57,7 +57,7 @@ struct TALER_MINT_WithdrawStatusHandle
/** /**
* Function to call with the result. * Function to call with the result.
*/ */
TALER_MINT_WithdrawStatusResultCallback cb; TALER_MINT_ReserveStatusResultCallback cb;
/** /**
* Public key of the reserve we are querying. * Public key of the reserve we are querying.
@ -264,16 +264,16 @@ parse_reserve_history (json_t *history,
/** /**
* Function called when we're done processing the * Function called when we're done processing the
* HTTP /withdraw/status request. * HTTP /reserve/status request.
* *
* @param cls the `struct TALER_MINT_WithdrawStatusHandle` * @param cls the `struct TALER_MINT_ReserveStatusHandle`
* @param eh curl handle of the request that finished * @param eh curl handle of the request that finished
*/ */
static void static void
handle_withdraw_status_finished (void *cls, handle_reserve_status_finished (void *cls,
CURL *eh) CURL *eh)
{ {
struct TALER_MINT_WithdrawStatusHandle *wsh = cls; struct TALER_MINT_ReserveStatusHandle *wsh = cls;
long response_code; long response_code;
json_t *json; json_t *json;
@ -376,7 +376,7 @@ handle_withdraw_status_finished (void *cls,
NULL, NULL,
0, NULL); 0, NULL);
json_decref (json); json_decref (json);
TALER_MINT_withdraw_status_cancel (wsh); TALER_MINT_reserve_status_cancel (wsh);
} }
@ -396,13 +396,13 @@ handle_withdraw_status_finished (void *cls,
* @return a handle for this request; NULL if the inputs are invalid (i.e. * @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not called. * signatures fail to verify). In this case, the callback is not called.
*/ */
struct TALER_MINT_WithdrawStatusHandle * struct TALER_MINT_ReserveStatusHandle *
TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint, TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
TALER_MINT_WithdrawStatusResultCallback cb, TALER_MINT_ReserveStatusResultCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct TALER_MINT_WithdrawStatusHandle *wsh; struct TALER_MINT_ReserveStatusHandle *wsh;
struct TALER_MINT_Context *ctx; struct TALER_MINT_Context *ctx;
CURL *eh; CURL *eh;
char *pub_str; char *pub_str;
@ -417,10 +417,10 @@ TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint,
pub_str = GNUNET_STRINGS_data_to_string_alloc (reserve_pub, pub_str = GNUNET_STRINGS_data_to_string_alloc (reserve_pub,
sizeof (struct TALER_ReservePublicKeyP)); sizeof (struct TALER_ReservePublicKeyP));
GNUNET_asprintf (&arg_str, GNUNET_asprintf (&arg_str,
"/withdraw/status?reserve_pub=%s", "/reserve/status?reserve_pub=%s",
pub_str); pub_str);
GNUNET_free (pub_str); GNUNET_free (pub_str);
wsh = GNUNET_new (struct TALER_MINT_WithdrawStatusHandle); wsh = GNUNET_new (struct TALER_MINT_ReserveStatusHandle);
wsh->mint = mint; wsh->mint = mint;
wsh->cb = cb; wsh->cb = cb;
wsh->cb_cls = cb_cls; wsh->cb_cls = cb_cls;
@ -446,7 +446,7 @@ TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint,
wsh->job = MAC_job_add (ctx, wsh->job = MAC_job_add (ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
&handle_withdraw_status_finished, &handle_reserve_status_finished,
wsh); wsh);
return wsh; return wsh;
} }
@ -459,7 +459,7 @@ TALER_MINT_withdraw_status (struct TALER_MINT_Handle *mint,
* @param wsh the withdraw status request handle * @param wsh the withdraw status request handle
*/ */
void void
TALER_MINT_withdraw_status_cancel (struct TALER_MINT_WithdrawStatusHandle *wsh) TALER_MINT_reserve_status_cancel (struct TALER_MINT_ReserveStatusHandle *wsh)
{ {
if (NULL != wsh->job) if (NULL != wsh->job)
{ {
@ -472,12 +472,12 @@ TALER_MINT_withdraw_status_cancel (struct TALER_MINT_WithdrawStatusHandle *wsh)
} }
/* ********************** /withdraw/sign ********************** */ /* ********************** /reserve/withdraw ********************** */
/** /**
* @brief A Withdraw Sign Handle * @brief A Withdraw Sign Handle
*/ */
struct TALER_MINT_WithdrawSignHandle struct TALER_MINT_ReserveWithdrawHandle
{ {
/** /**
@ -503,7 +503,7 @@ struct TALER_MINT_WithdrawSignHandle
/** /**
* Function to call with the result. * Function to call with the result.
*/ */
TALER_MINT_WithdrawSignResultCallback cb; TALER_MINT_ReserveWithdrawResultCallback cb;
/** /**
* Key used to blind the value. * Key used to blind the value.
@ -539,7 +539,7 @@ struct TALER_MINT_WithdrawSignHandle
/** /**
* We got a 200 OK response for the /withdraw/sign operation. * We got a 200 OK response for the /reserve/withdraw operation.
* Extract the coin's signature and return it to the caller. * Extract the coin's signature and return it to the caller.
* The signature we get from the mint is for the blinded value. * The signature we get from the mint is for the blinded value.
* Thus, we first must unblind it and then should verify its * Thus, we first must unblind it and then should verify its
@ -553,7 +553,7 @@ struct TALER_MINT_WithdrawSignHandle
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/ */
static int static int
withdraw_sign_ok (struct TALER_MINT_WithdrawSignHandle *wsh, reserve_withdraw_ok (struct TALER_MINT_ReserveWithdrawHandle *wsh,
json_t *json) json_t *json)
{ {
struct GNUNET_CRYPTO_rsa_Signature *blind_sig; struct GNUNET_CRYPTO_rsa_Signature *blind_sig;
@ -598,7 +598,7 @@ withdraw_sign_ok (struct TALER_MINT_WithdrawSignHandle *wsh,
/** /**
* We got a 402 PAYMENT REQUIRED response for the /withdraw/sign operation. * We got a 402 PAYMENT REQUIRED response for the /reserve/withdraw operation.
* Check the signatures on the withdraw transactions in the provided * Check the signatures on the withdraw transactions in the provided
* history and that the balances add up. We don't do anything directly * history and that the balances add up. We don't do anything directly
* with the information, as the JSON will be returned to the application. * with the information, as the JSON will be returned to the application.
@ -610,8 +610,8 @@ withdraw_sign_ok (struct TALER_MINT_WithdrawSignHandle *wsh,
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/ */
static int static int
withdraw_sign_payment_required (struct TALER_MINT_WithdrawSignHandle *wsh, reserve_withdraw_payment_required (struct TALER_MINT_ReserveWithdrawHandle *wsh,
json_t *json) json_t *json)
{ {
struct TALER_Amount balance; struct TALER_Amount balance;
struct TALER_Amount balance_from_history; struct TALER_Amount balance_from_history;
@ -690,16 +690,16 @@ withdraw_sign_payment_required (struct TALER_MINT_WithdrawSignHandle *wsh,
/** /**
* Function called when we're done processing the * Function called when we're done processing the
* HTTP /withdraw/sign request. * HTTP /reserve/withdraw request.
* *
* @param cls the `struct TALER_MINT_WithdrawSignHandle` * @param cls the `struct TALER_MINT_ReserveWithdrawHandle`
* @param eh curl handle of the request that finished * @param eh curl handle of the request that finished
*/ */
static void static void
handle_withdraw_sign_finished (void *cls, handle_reserve_withdraw_finished (void *cls,
CURL *eh) CURL *eh)
{ {
struct TALER_MINT_WithdrawSignHandle *wsh = cls; struct TALER_MINT_ReserveWithdrawHandle *wsh = cls;
long response_code; long response_code;
json_t *json; json_t *json;
@ -713,7 +713,7 @@ handle_withdraw_sign_finished (void *cls,
break; break;
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
withdraw_sign_ok (wsh, reserve_withdraw_ok (wsh,
json)) json))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -728,7 +728,7 @@ handle_withdraw_sign_finished (void *cls,
/* The mint says that the reserve has insufficient funds; /* The mint says that the reserve has insufficient funds;
check the signatures in the history... */ check the signatures in the history... */
if (GNUNET_OK != if (GNUNET_OK !=
withdraw_sign_payment_required (wsh, reserve_withdraw_payment_required (wsh,
json)) json))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -766,12 +766,12 @@ handle_withdraw_sign_finished (void *cls,
NULL, NULL,
json); json);
json_decref (json); json_decref (json);
TALER_MINT_withdraw_sign_cancel (wsh); TALER_MINT_reserve_withdraw_cancel (wsh);
} }
/** /**
* Withdraw a coin from the mint using a /withdraw/sign request. Note * Withdraw a coin from the mint using a /reserve/withdraw request. Note
* that to ensure that no money is lost in case of hardware failures, * that to ensure that no money is lost in case of hardware failures,
* the caller must have committed (most of) the arguments to disk * the caller must have committed (most of) the arguments to disk
* before calling, and be ready to repeat the request with the same * before calling, and be ready to repeat the request with the same
@ -790,16 +790,16 @@ handle_withdraw_sign_finished (void *cls,
* if the inputs are invalid (i.e. denomination key not with this mint). * if the inputs are invalid (i.e. denomination key not with this mint).
* In this case, the callback is not called. * In this case, the callback is not called.
*/ */
struct TALER_MINT_WithdrawSignHandle * struct TALER_MINT_ReserveWithdrawHandle *
TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint, TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
const struct TALER_MINT_DenomPublicKey *pk, const struct TALER_MINT_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePrivateKeyP *reserve_priv,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_DenominationBlindingKey *blinding_key, const struct TALER_DenominationBlindingKey *blinding_key,
TALER_MINT_WithdrawSignResultCallback res_cb, TALER_MINT_ReserveWithdrawResultCallback res_cb,
void *res_cb_cls) void *res_cb_cls)
{ {
struct TALER_MINT_WithdrawSignHandle *wsh; struct TALER_MINT_ReserveWithdrawHandle *wsh;
struct TALER_WithdrawRequestPS req; struct TALER_WithdrawRequestPS req;
struct TALER_ReserveSignatureP reserve_sig; struct TALER_ReserveSignatureP reserve_sig;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
@ -810,7 +810,7 @@ TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint,
json_t *withdraw_obj; json_t *withdraw_obj;
CURL *eh; CURL *eh;
wsh = GNUNET_new (struct TALER_MINT_WithdrawSignHandle); wsh = GNUNET_new (struct TALER_MINT_ReserveWithdrawHandle);
wsh->mint = mint; wsh->mint = mint;
wsh->cb = res_cb; wsh->cb = res_cb;
wsh->cb_cls = res_cb_cls; wsh->cb_cls = res_cb_cls;
@ -866,7 +866,7 @@ TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint,
GNUNET_free (coin_ev); GNUNET_free (coin_ev);
wsh->blinding_key = blinding_key; wsh->blinding_key = blinding_key;
wsh->url = MAH_path_to_url (mint, "/withdraw/sign"); wsh->url = MAH_path_to_url (mint, "/reserve/withdraw");
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != (wsh->json_enc = GNUNET_assert (NULL != (wsh->json_enc =
@ -897,7 +897,7 @@ TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint,
wsh->job = MAC_job_add (ctx, wsh->job = MAC_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
&handle_withdraw_sign_finished, &handle_reserve_withdraw_finished,
wsh); wsh);
return wsh; return wsh;
} }
@ -910,7 +910,7 @@ TALER_MINT_withdraw_sign (struct TALER_MINT_Handle *mint,
* @param sign the withdraw sign request handle * @param sign the withdraw sign request handle
*/ */
void void
TALER_MINT_withdraw_sign_cancel (struct TALER_MINT_WithdrawSignHandle *sign) TALER_MINT_reserve_withdraw_cancel (struct TALER_MINT_ReserveWithdrawHandle *sign)
{ {
if (NULL != sign->job) if (NULL != sign->job)
{ {
@ -924,4 +924,4 @@ TALER_MINT_withdraw_sign_cancel (struct TALER_MINT_WithdrawSignHandle *sign)
} }
/* end of mint_api_withdraw.c */ /* end of mint_api_reserve.c */

View File

@ -131,7 +131,7 @@ struct MeltDetails
const char *amount; const char *amount;
/** /**
* Reference to withdraw_sign operations for coin to * Reference to reserve_withdraw operations for coin to
* be used for the /refresh/melt operation. * be used for the /refresh/melt operation.
*/ */
const char *coin_ref; const char *coin_ref;
@ -243,14 +243,14 @@ struct Command
/** /**
* Set to the API's handle during the operation. * Set to the API's handle during the operation.
*/ */
struct TALER_MINT_WithdrawStatusHandle *wsh; struct TALER_MINT_ReserveStatusHandle *wsh;
/** /**
* Expected reserve balance. * Expected reserve balance.
*/ */
const char *expected_balance; const char *expected_balance;
} withdraw_status; } reserve_status;
/** /**
* Information for a #OC_WITHDRAW_SIGN command. * Information for a #OC_WITHDRAW_SIGN command.
@ -296,9 +296,9 @@ struct Command
/** /**
* Withdraw handle (while operation is running). * Withdraw handle (while operation is running).
*/ */
struct TALER_MINT_WithdrawSignHandle *wsh; struct TALER_MINT_ReserveWithdrawHandle *wsh;
} withdraw_sign; } reserve_withdraw;
/** /**
* Information for a #OC_DEPOSIT command. * Information for a #OC_DEPOSIT command.
@ -312,7 +312,7 @@ struct Command
const char *amount; const char *amount;
/** /**
* Reference to a withdraw_sign operation for a coin to * Reference to a reserve_withdraw operation for a coin to
* be used for the /deposit operation. * be used for the /deposit operation.
*/ */
const char *coin_ref; const char *coin_ref;
@ -649,8 +649,8 @@ compare_admin_add_incoming_history (const struct TALER_MINT_ReserveHistory *h,
* @return #GNUNET_OK if they match, #GNUNET_SYSERR if not * @return #GNUNET_OK if they match, #GNUNET_SYSERR if not
*/ */
static int static int
compare_withdraw_sign_history (const struct TALER_MINT_ReserveHistory *h, compare_reserve_withdraw_history (const struct TALER_MINT_ReserveHistory *h,
const struct Command *cmd) const struct Command *cmd)
{ {
struct TALER_Amount amount; struct TALER_Amount amount;
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
@ -661,12 +661,12 @@ compare_withdraw_sign_history (const struct TALER_MINT_ReserveHistory *h,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (cmd->details.withdraw_sign.amount, TALER_string_to_amount (cmd->details.reserve_withdraw.amount,
&amount)); &amount));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&amount_with_fee, TALER_amount_add (&amount_with_fee,
&amount, &amount,
&cmd->details.withdraw_sign.pk->fee_withdraw)); &cmd->details.reserve_withdraw.pk->fee_withdraw));
if (0 != TALER_amount_cmp (&amount_with_fee, if (0 != TALER_amount_cmp (&amount_with_fee,
&h->amount)) &h->amount))
{ {
@ -678,7 +678,7 @@ compare_withdraw_sign_history (const struct TALER_MINT_ReserveHistory *h,
/** /**
* Function called with the result of a /withdraw/status request. * Function called with the result of a /reserve/status request.
* *
* @param cls closure with the interpreter state * @param cls closure with the interpreter state
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
@ -689,12 +689,12 @@ compare_withdraw_sign_history (const struct TALER_MINT_ReserveHistory *h,
* @param history detailed transaction history, NULL on error * @param history detailed transaction history, NULL on error
*/ */
static void static void
withdraw_status_cb (void *cls, reserve_status_cb (void *cls,
unsigned int http_status, unsigned int http_status,
json_t *json, json_t *json,
const struct TALER_Amount *balance, const struct TALER_Amount *balance,
unsigned int history_length, unsigned int history_length,
const struct TALER_MINT_ReserveHistory *history) const struct TALER_MINT_ReserveHistory *history)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip]; struct Command *cmd = &is->commands[is->ip];
@ -703,7 +703,7 @@ withdraw_status_cb (void *cls,
unsigned int j; unsigned int j;
struct TALER_Amount amount; struct TALER_Amount amount;
cmd->details.withdraw_status.wsh = NULL; cmd->details.reserve_status.wsh = NULL;
if (cmd->expected_response_code != http_status) if (cmd->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -727,10 +727,10 @@ withdraw_status_cb (void *cls,
{ {
case OC_ADMIN_ADD_INCOMING: case OC_ADMIN_ADD_INCOMING:
if ( ( (NULL != rel->label) && if ( ( (NULL != rel->label) &&
(0 == strcmp (cmd->details.withdraw_status.reserve_reference, (0 == strcmp (cmd->details.reserve_status.reserve_reference,
rel->label) ) ) || rel->label) ) ) ||
( (NULL != rel->details.admin_add_incoming.reserve_reference) && ( (NULL != rel->details.admin_add_incoming.reserve_reference) &&
(0 == strcmp (cmd->details.withdraw_status.reserve_reference, (0 == strcmp (cmd->details.reserve_status.reserve_reference,
rel->details.admin_add_incoming.reserve_reference) ) ) ) rel->details.admin_add_incoming.reserve_reference) ) ) )
{ {
if (GNUNET_OK != if (GNUNET_OK !=
@ -745,11 +745,11 @@ withdraw_status_cb (void *cls,
} }
break; break;
case OC_WITHDRAW_SIGN: case OC_WITHDRAW_SIGN:
if (0 == strcmp (cmd->details.withdraw_status.reserve_reference, if (0 == strcmp (cmd->details.reserve_status.reserve_reference,
rel->details.withdraw_sign.reserve_reference)) rel->details.reserve_withdraw.reserve_reference))
{ {
if (GNUNET_OK != if (GNUNET_OK !=
compare_withdraw_sign_history (&history[j], compare_reserve_withdraw_history (&history[j],
rel)) rel))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -770,10 +770,10 @@ withdraw_status_cb (void *cls,
fail (is); fail (is);
return; return;
} }
if (NULL != cmd->details.withdraw_status.expected_balance) if (NULL != cmd->details.reserve_status.expected_balance)
{ {
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (cmd->details.withdraw_status.expected_balance, TALER_string_to_amount (cmd->details.reserve_status.expected_balance,
&amount)); &amount));
if (0 != TALER_amount_cmp (&amount, if (0 != TALER_amount_cmp (&amount,
balance)) balance))
@ -796,7 +796,7 @@ withdraw_status_cb (void *cls,
/** /**
* Function called upon completion of our /withdraw/sign request. * Function called upon completion of our /reserve/withdraw request.
* *
* @param cls closure with the interpreter state * @param cls closure with the interpreter state
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
@ -805,15 +805,15 @@ withdraw_status_cb (void *cls,
* @param full_response full response from the mint (for logging, in case of errors) * @param full_response full response from the mint (for logging, in case of errors)
*/ */
static void static void
withdraw_sign_cb (void *cls, reserve_withdraw_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_DenominationSignature *sig, const struct TALER_DenominationSignature *sig,
json_t *full_response) json_t *full_response)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip]; struct Command *cmd = &is->commands[is->ip];
cmd->details.withdraw_sign.wsh = NULL; cmd->details.reserve_withdraw.wsh = NULL;
if (cmd->expected_response_code != http_status) if (cmd->expected_response_code != http_status)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -834,7 +834,7 @@ withdraw_sign_cb (void *cls,
fail (is); fail (is);
return; return;
} }
cmd->details.withdraw_sign.sig.rsa_signature cmd->details.reserve_withdraw.sig.rsa_signature
= GNUNET_CRYPTO_rsa_signature_dup (sig->rsa_signature); = GNUNET_CRYPTO_rsa_signature_dup (sig->rsa_signature);
break; break;
case MHD_HTTP_PAYMENT_REQUIRED: case MHD_HTTP_PAYMENT_REQUIRED:
@ -1309,44 +1309,44 @@ interpreter_run (void *cls,
return; return;
case OC_WITHDRAW_STATUS: case OC_WITHDRAW_STATUS:
GNUNET_assert (NULL != GNUNET_assert (NULL !=
cmd->details.withdraw_status.reserve_reference); cmd->details.reserve_status.reserve_reference);
ref = find_command (is, ref = find_command (is,
cmd->details.withdraw_status.reserve_reference); cmd->details.reserve_status.reserve_reference);
GNUNET_assert (NULL != ref); GNUNET_assert (NULL != ref);
GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc); GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc);
GNUNET_CRYPTO_eddsa_key_get_public (&ref->details.admin_add_incoming.reserve_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&ref->details.admin_add_incoming.reserve_priv.eddsa_priv,
&reserve_pub.eddsa_pub); &reserve_pub.eddsa_pub);
cmd->details.withdraw_status.wsh cmd->details.reserve_status.wsh
= TALER_MINT_withdraw_status (mint, = TALER_MINT_reserve_status (mint,
&reserve_pub, &reserve_pub,
&withdraw_status_cb, &reserve_status_cb,
is); is);
trigger_context_task (); trigger_context_task ();
return; return;
case OC_WITHDRAW_SIGN: case OC_WITHDRAW_SIGN:
GNUNET_assert (NULL != GNUNET_assert (NULL !=
cmd->details.withdraw_sign.reserve_reference); cmd->details.reserve_withdraw.reserve_reference);
ref = find_command (is, ref = find_command (is,
cmd->details.withdraw_sign.reserve_reference); cmd->details.reserve_withdraw.reserve_reference);
GNUNET_assert (NULL != ref); GNUNET_assert (NULL != ref);
GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc); GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc);
if (NULL != cmd->details.withdraw_sign.amount) if (NULL != cmd->details.reserve_withdraw.amount)
{ {
if (GNUNET_OK != if (GNUNET_OK !=
TALER_string_to_amount (cmd->details.withdraw_sign.amount, TALER_string_to_amount (cmd->details.reserve_withdraw.amount,
&amount)) &amount))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse amount `%s' at %u\n", "Failed to parse amount `%s' at %u\n",
cmd->details.withdraw_sign.amount, cmd->details.reserve_withdraw.amount,
is->ip); is->ip);
fail (is); fail (is);
return; return;
} }
cmd->details.withdraw_sign.pk = find_pk (is->keys, cmd->details.reserve_withdraw.pk = find_pk (is->keys,
&amount); &amount);
} }
if (NULL == cmd->details.withdraw_sign.pk) if (NULL == cmd->details.reserve_withdraw.pk)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to determine denomination key at %u\n", "Failed to determine denomination key at %u\n",
@ -1360,22 +1360,22 @@ interpreter_run (void *cls,
struct GNUNET_CRYPTO_EddsaPrivateKey *priv; struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
priv = GNUNET_CRYPTO_eddsa_key_create (); priv = GNUNET_CRYPTO_eddsa_key_create ();
cmd->details.withdraw_sign.coin_priv.eddsa_priv = *priv; cmd->details.reserve_withdraw.coin_priv.eddsa_priv = *priv;
GNUNET_free (priv); GNUNET_free (priv);
} }
GNUNET_CRYPTO_eddsa_key_get_public (&cmd->details.withdraw_sign.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&cmd->details.reserve_withdraw.coin_priv.eddsa_priv,
&coin_pub.eddsa_pub); &coin_pub.eddsa_pub);
cmd->details.withdraw_sign.blinding_key.rsa_blinding_key cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key
= GNUNET_CRYPTO_rsa_blinding_key_create (GNUNET_CRYPTO_rsa_public_key_len (cmd->details.withdraw_sign.pk->key.rsa_public_key)); = GNUNET_CRYPTO_rsa_blinding_key_create (GNUNET_CRYPTO_rsa_public_key_len (cmd->details.reserve_withdraw.pk->key.rsa_public_key));
cmd->details.withdraw_sign.wsh cmd->details.reserve_withdraw.wsh
= TALER_MINT_withdraw_sign (mint, = TALER_MINT_reserve_withdraw (mint,
cmd->details.withdraw_sign.pk, cmd->details.reserve_withdraw.pk,
&ref->details.admin_add_incoming.reserve_priv, &ref->details.admin_add_incoming.reserve_priv,
&cmd->details.withdraw_sign.coin_priv, &cmd->details.reserve_withdraw.coin_priv,
&cmd->details.withdraw_sign.blinding_key, &cmd->details.reserve_withdraw.blinding_key,
&withdraw_sign_cb, &reserve_withdraw_cb,
is); is);
if (NULL == cmd->details.withdraw_sign.wsh) if (NULL == cmd->details.reserve_withdraw.wsh)
{ {
GNUNET_break (0); GNUNET_break (0);
fail (is); fail (is);
@ -1404,9 +1404,9 @@ interpreter_run (void *cls,
switch (ref->oc) switch (ref->oc)
{ {
case OC_WITHDRAW_SIGN: case OC_WITHDRAW_SIGN:
coin_priv = &ref->details.withdraw_sign.coin_priv; coin_priv = &ref->details.reserve_withdraw.coin_priv;
coin_pk = ref->details.withdraw_sign.pk; coin_pk = ref->details.reserve_withdraw.pk;
coin_pk_sig = &ref->details.withdraw_sign.sig; coin_pk_sig = &ref->details.reserve_withdraw.sig;
break; break;
case OC_REFRESH_REVEAL: case OC_REFRESH_REVEAL:
{ {
@ -1549,7 +1549,7 @@ interpreter_run (void *cls,
GNUNET_assert (NULL != ref); GNUNET_assert (NULL != ref);
GNUNET_assert (OC_WITHDRAW_SIGN == ref->oc); GNUNET_assert (OC_WITHDRAW_SIGN == ref->oc);
melt_privs[i] = ref->details.withdraw_sign.coin_priv; melt_privs[i] = ref->details.reserve_withdraw.coin_priv;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_string_to_amount (md->amount, TALER_string_to_amount (md->amount,
&melt_amounts[i])) &melt_amounts[i]))
@ -1561,8 +1561,8 @@ interpreter_run (void *cls,
fail (is); fail (is);
return; return;
} }
melt_sigs[i] = ref->details.withdraw_sign.sig; melt_sigs[i] = ref->details.reserve_withdraw.sig;
melt_pks[i] = *ref->details.withdraw_sign.pk; melt_pks[i] = *ref->details.reserve_withdraw.pk;
} }
for (i=0;i<num_fresh_coins;i++) for (i=0;i<num_fresh_coins;i++)
{ {
@ -1572,7 +1572,7 @@ interpreter_run (void *cls,
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse amount `%s' at %u\n", "Failed to parse amount `%s' at %u\n",
cmd->details.withdraw_sign.amount, cmd->details.reserve_withdraw.amount,
is->ip); is->ip);
fail (is); fail (is);
return; return;
@ -1639,7 +1639,7 @@ interpreter_run (void *cls,
/* find melt command */ /* find melt command */
ref = find_command (is, ref = find_command (is,
ref->details.refresh_reveal.melt_ref); ref->details.refresh_reveal.melt_ref);
/* find withdraw_sign command */ /* find reserve_withdraw command */
{ {
unsigned int idx; unsigned int idx;
const struct MeltDetails *md; const struct MeltDetails *md;
@ -1658,7 +1658,7 @@ interpreter_run (void *cls,
/* finally, use private key from withdraw sign command */ /* finally, use private key from withdraw sign command */
cmd->details.refresh_link.rlh cmd->details.refresh_link.rlh
= TALER_MINT_refresh_link (mint, = TALER_MINT_refresh_link (mint,
&ref->details.withdraw_sign.coin_priv, &ref->details.reserve_withdraw.coin_priv,
&link_cb, &link_cb,
is); is);
if (NULL == cmd->details.refresh_link.rlh) if (NULL == cmd->details.refresh_link.rlh)
@ -1724,35 +1724,35 @@ do_shutdown (void *cls,
} }
break; break;
case OC_WITHDRAW_STATUS: case OC_WITHDRAW_STATUS:
if (NULL != cmd->details.withdraw_status.wsh) if (NULL != cmd->details.reserve_status.wsh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Command %u (%s) did not complete\n", "Command %u (%s) did not complete\n",
i, i,
cmd->label); cmd->label);
TALER_MINT_withdraw_status_cancel (cmd->details.withdraw_status.wsh); TALER_MINT_reserve_status_cancel (cmd->details.reserve_status.wsh);
cmd->details.withdraw_status.wsh = NULL; cmd->details.reserve_status.wsh = NULL;
} }
break; break;
case OC_WITHDRAW_SIGN: case OC_WITHDRAW_SIGN:
if (NULL != cmd->details.withdraw_sign.wsh) if (NULL != cmd->details.reserve_withdraw.wsh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Command %u (%s) did not complete\n", "Command %u (%s) did not complete\n",
i, i,
cmd->label); cmd->label);
TALER_MINT_withdraw_sign_cancel (cmd->details.withdraw_sign.wsh); TALER_MINT_reserve_withdraw_cancel (cmd->details.reserve_withdraw.wsh);
cmd->details.withdraw_sign.wsh = NULL; cmd->details.reserve_withdraw.wsh = NULL;
} }
if (NULL != cmd->details.withdraw_sign.sig.rsa_signature) if (NULL != cmd->details.reserve_withdraw.sig.rsa_signature)
{ {
GNUNET_CRYPTO_rsa_signature_free (cmd->details.withdraw_sign.sig.rsa_signature); GNUNET_CRYPTO_rsa_signature_free (cmd->details.reserve_withdraw.sig.rsa_signature);
cmd->details.withdraw_sign.sig.rsa_signature = NULL; cmd->details.reserve_withdraw.sig.rsa_signature = NULL;
} }
if (NULL != cmd->details.withdraw_sign.blinding_key.rsa_blinding_key) if (NULL != cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key)
{ {
GNUNET_CRYPTO_rsa_blinding_key_free (cmd->details.withdraw_sign.blinding_key.rsa_blinding_key); GNUNET_CRYPTO_rsa_blinding_key_free (cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key);
cmd->details.withdraw_sign.blinding_key.rsa_blinding_key = NULL; cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key = NULL;
} }
break; break;
case OC_DEPOSIT: case OC_DEPOSIT:
@ -2018,15 +2018,15 @@ run (void *cls,
{ .oc = OC_WITHDRAW_SIGN, { .oc = OC_WITHDRAW_SIGN,
.label = "withdraw-coin-1", .label = "withdraw-coin-1",
.expected_response_code = MHD_HTTP_OK, .expected_response_code = MHD_HTTP_OK,
.details.withdraw_sign.reserve_reference = "create-reserve-1", .details.reserve_withdraw.reserve_reference = "create-reserve-1",
.details.withdraw_sign.amount = "EUR:5" }, .details.reserve_withdraw.amount = "EUR:5" },
/* Check that deposit and withdraw operation are in history, and /* Check that deposit and withdraw operation are in history, and
that the balance is now at zero */ that the balance is now at zero */
{ .oc = OC_WITHDRAW_STATUS, { .oc = OC_WITHDRAW_STATUS,
.label = "withdraw-status-1", .label = "withdraw-status-1",
.expected_response_code = MHD_HTTP_OK, .expected_response_code = MHD_HTTP_OK,
.details.withdraw_status.reserve_reference = "create-reserve-1", .details.reserve_status.reserve_reference = "create-reserve-1",
.details.withdraw_status.expected_balance = "EUR:0" }, .details.reserve_status.expected_balance = "EUR:0" },
/* Try to deposit the 5 EUR coin (in full) */ /* Try to deposit the 5 EUR coin (in full) */
{ .oc = OC_DEPOSIT, { .oc = OC_DEPOSIT,
.label = "deposit-simple", .label = "deposit-simple",
@ -2041,8 +2041,8 @@ run (void *cls,
{ .oc = OC_WITHDRAW_SIGN, { .oc = OC_WITHDRAW_SIGN,
.label = "withdraw-coin-2", .label = "withdraw-coin-2",
.expected_response_code = MHD_HTTP_PAYMENT_REQUIRED, .expected_response_code = MHD_HTTP_PAYMENT_REQUIRED,
.details.withdraw_sign.reserve_reference = "create-reserve-1", .details.reserve_withdraw.reserve_reference = "create-reserve-1",
.details.withdraw_sign.amount = "EUR:5" }, .details.reserve_withdraw.amount = "EUR:5" },
/* Try to double-spend the 5 EUR coin with different wire details */ /* Try to double-spend the 5 EUR coin with different wire details */
{ .oc = OC_DEPOSIT, { .oc = OC_DEPOSIT,
@ -2086,8 +2086,8 @@ run (void *cls,
{ .oc = OC_WITHDRAW_SIGN, { .oc = OC_WITHDRAW_SIGN,
.label = "refresh-withdraw-coin-1", .label = "refresh-withdraw-coin-1",
.expected_response_code = MHD_HTTP_OK, .expected_response_code = MHD_HTTP_OK,
.details.withdraw_sign.reserve_reference = "refresh-create-reserve-1", .details.reserve_withdraw.reserve_reference = "refresh-create-reserve-1",
.details.withdraw_sign.amount = "EUR:5" }, .details.reserve_withdraw.amount = "EUR:5" },
/* Try to partially spend (deposit) 1 EUR of the 5 EUR coin (in full) /* Try to partially spend (deposit) 1 EUR of the 5 EUR coin (in full)
(merchant would receive EUR:0.99 due to 1 ct deposit fee) */ (merchant would receive EUR:0.99 due to 1 ct deposit fee) */
{ .oc = OC_DEPOSIT, { .oc = OC_DEPOSIT,

View File

@ -18,7 +18,7 @@ taler_mint_httpd_SOURCES = \
taler-mint-httpd_mhd.c taler-mint-httpd_mhd.h \ taler-mint-httpd_mhd.c taler-mint-httpd_mhd.h \
taler-mint-httpd_admin.c taler-mint-httpd_admin.h \ taler-mint-httpd_admin.c taler-mint-httpd_admin.h \
taler-mint-httpd_deposit.c taler-mint-httpd_deposit.h \ taler-mint-httpd_deposit.c taler-mint-httpd_deposit.h \
taler-mint-httpd_withdraw.c taler-mint-httpd_withdraw.h \ taler-mint-httpd_reserve.c taler-mint-httpd_reserve.h \
taler-mint-httpd_wire.c taler-mint-httpd_wire.h \ taler-mint-httpd_wire.c taler-mint-httpd_wire.h \
taler-mint-httpd_refresh.c taler-mint-httpd_refresh.h taler-mint-httpd_refresh.c taler-mint-httpd_refresh.h
taler_mint_httpd_LDADD = \ taler_mint_httpd_LDADD = \

View File

@ -30,7 +30,7 @@
#include "taler-mint-httpd_mhd.h" #include "taler-mint-httpd_mhd.h"
#include "taler-mint-httpd_admin.h" #include "taler-mint-httpd_admin.h"
#include "taler-mint-httpd_deposit.h" #include "taler-mint-httpd_deposit.h"
#include "taler-mint-httpd_withdraw.h" #include "taler-mint-httpd_reserve.h"
#include "taler-mint-httpd_wire.h" #include "taler-mint-httpd_wire.h"
#include "taler-mint-httpd_refresh.h" #include "taler-mint-httpd_refresh.h"
#include "taler-mint-httpd_keystate.h" #include "taler-mint-httpd_keystate.h"
@ -190,17 +190,17 @@ handle_mhd_request (void *cls,
&TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
/* Withdrawing coins / interaction with reserves */ /* Withdrawing coins / interaction with reserves */
{ "/withdraw/status", MHD_HTTP_METHOD_GET, "application/json", { "/reserve/status", MHD_HTTP_METHOD_GET, "application/json",
NULL, 0, NULL, 0,
&TMH_WITHDRAW_handler_withdraw_status, MHD_HTTP_OK }, &TMH_RESERVE_handler_reserve_status, MHD_HTTP_OK },
{ "/withdraw/status", NULL, "text/plain", { "/reserve/status", NULL, "text/plain",
"Only GET is allowed", 0, "Only GET is allowed", 0,
&TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
{ "/withdraw/sign", MHD_HTTP_METHOD_POST, "application/json", { "/reserve/withdraw", MHD_HTTP_METHOD_POST, "application/json",
NULL, 0, NULL, 0,
&TMH_WITHDRAW_handler_withdraw_sign, MHD_HTTP_OK }, &TMH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK },
{ "/withdraw/sign", NULL, "text/plain", { "/reserve/withdraw", NULL, "text/plain",
"Only POST is allowed", 0, "Only POST is allowed", 0,
&TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },

View File

@ -203,7 +203,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
/** /**
* Execute a /withdraw/status. Given the public key of a reserve, * Execute a /reserve/status. Given the public key of a reserve,
* return the associated transaction history. * return the associated transaction history.
* *
* @param connection the MHD connection to handle * @param connection the MHD connection to handle
@ -211,8 +211,8 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, TMH_DB_execute_reserve_status (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve_pub) const struct TALER_ReservePublicKeyP *reserve_pub)
{ {
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct TALER_MINTDB_ReserveHistory *rh; struct TALER_MINTDB_ReserveHistory *rh;
@ -233,7 +233,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
"{s:s, s:s}", "{s:s, s:s}",
"error", "Reserve not found", "error", "Reserve not found",
"parameter", "withdraw_pub"); "parameter", "withdraw_pub");
res = TMH_RESPONSE_reply_withdraw_status_success (connection, res = TMH_RESPONSE_reply_reserve_status_success (connection,
rh); rh);
TMH_plugin->free_reserve_history (TMH_plugin->cls, TMH_plugin->free_reserve_history (TMH_plugin->cls,
rh); rh);
@ -242,7 +242,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
/** /**
* Execute a "/withdraw/sign". Given a reserve and a properly signed * Execute a "/reserve/withdraw". Given a reserve and a properly signed
* request to withdraw a coin, check the balance of the reserve and * request to withdraw a coin, check the balance of the reserve and
* if it is sufficient, store the request and return the signed * if it is sufficient, store the request and return the signed
* blinded envelope. * blinded envelope.
@ -256,12 +256,12 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve, const struct TALER_ReservePublicKeyP *reserve,
const struct TALER_DenominationPublicKey *denomination_pub, const struct TALER_DenominationPublicKey *denomination_pub,
const char *blinded_msg, const char *blinded_msg,
size_t blinded_msg_len, size_t blinded_msg_len,
const struct TALER_ReserveSignatureP *signature) const struct TALER_ReserveSignatureP *signature)
{ {
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct TALER_MINTDB_ReserveHistory *rh; struct TALER_MINTDB_ReserveHistory *rh;
@ -303,7 +303,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
/* Don't sign again if we have already signed the coin */ /* Don't sign again if we have already signed the coin */
if (GNUNET_YES == res) if (GNUNET_YES == res)
{ {
res = TMH_RESPONSE_reply_withdraw_sign_success (connection, res = TMH_RESPONSE_reply_reserve_withdraw_success (connection,
&collectable); &collectable);
GNUNET_CRYPTO_rsa_signature_free (collectable.sig.rsa_signature); GNUNET_CRYPTO_rsa_signature_free (collectable.sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub.rsa_public_key); GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub.rsa_public_key);
@ -431,7 +431,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
TMH_KS_release (key_state); TMH_KS_release (key_state);
TMH_plugin->rollback (TMH_plugin->cls, TMH_plugin->rollback (TMH_plugin->cls,
session); session);
res = TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (connection, res = TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (connection,
rh); rh);
TMH_plugin->free_reserve_history (TMH_plugin->cls, TMH_plugin->free_reserve_history (TMH_plugin->cls,
rh); rh);
@ -475,10 +475,10 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
TMH_plugin->commit (TMH_plugin->cls, TMH_plugin->commit (TMH_plugin->cls,
session)) session))
{ {
TALER_LOG_WARNING ("/withdraw/sign transaction commit failed\n"); TALER_LOG_WARNING ("/reserve/withdraw transaction commit failed\n");
return TMH_RESPONSE_reply_commit_error (connection); return TMH_RESPONSE_reply_commit_error (connection);
} }
res = TMH_RESPONSE_reply_withdraw_sign_success (connection, res = TMH_RESPONSE_reply_reserve_withdraw_success (connection,
&collectable); &collectable);
GNUNET_CRYPTO_rsa_signature_free (sig); GNUNET_CRYPTO_rsa_signature_free (sig);
return res; return res;

View File

@ -41,7 +41,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
/** /**
* Execute a "/withdraw/status". Given the public key of a reserve, * Execute a "/reserve/status". Given the public key of a reserve,
* return the associated transaction history. * return the associated transaction history.
* *
* @param connection the MHD connection to handle * @param connection the MHD connection to handle
@ -49,12 +49,12 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, TMH_DB_execute_reserve_status (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve_pub); const struct TALER_ReservePublicKeyP *reserve_pub);
/** /**
* Execute a "/withdraw/sign". Given a reserve and a properly signed * Execute a "/reserve/withdraw". Given a reserve and a properly signed
* request to withdraw a coin, check the balance of the reserve and * request to withdraw a coin, check the balance of the reserve and
* if it is sufficient, store the request and return the signed * if it is sufficient, store the request and return the signed
* blinded envelope. * blinded envelope.
@ -68,12 +68,12 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve, const struct TALER_ReservePublicKeyP *reserve,
const struct TALER_DenominationPublicKey *denomination_pub, const struct TALER_DenominationPublicKey *denomination_pub,
const char *blinded_msg, const char *blinded_msg,
size_t blinded_msg_len, size_t blinded_msg_len,
const struct TALER_ReserveSignatureP *signature); const struct TALER_ReserveSignatureP *signature);
/** /**

View File

@ -65,7 +65,7 @@ TMH_KS_release (struct TMH_KS_StateHandle *key_state);
enum TMH_KS_DenominationKeyUse { enum TMH_KS_DenominationKeyUse {
/** /**
* The key is to be used for a /withdraw/sign or /refresh (mint) * The key is to be used for a /reserve/withdraw or /refresh (mint)
* operation. * operation.
*/ */
TMH_KS_DKU_WITHDRAW, TMH_KS_DKU_WITHDRAW,

View File

@ -14,8 +14,8 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file taler-mint-httpd_withdraw.c * @file taler-mint-httpd_reserve.c
* @brief Handle /withdraw/ requests * @brief Handle /reserve/ requests
* @author Florian Dold * @author Florian Dold
* @author Benedikt Mueller * @author Benedikt Mueller
* @author Christian Grothoff * @author Christian Grothoff
@ -23,14 +23,14 @@
#include "platform.h" #include "platform.h"
#include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_util_lib.h>
#include <jansson.h> #include <jansson.h>
#include "taler-mint-httpd_withdraw.h" #include "taler-mint-httpd_reserve.h"
#include "taler-mint-httpd_parsing.h" #include "taler-mint-httpd_parsing.h"
#include "taler-mint-httpd_responses.h" #include "taler-mint-httpd_responses.h"
#include "taler-mint-httpd_keystate.h" #include "taler-mint-httpd_keystate.h"
/** /**
* Handle a "/withdraw/status" request. Parses the * Handle a "/reserve/status" request. Parses the
* given "reserve_pub" argument (which should contain the * given "reserve_pub" argument (which should contain the
* EdDSA public key of a reserve) and then respond with the * EdDSA public key of a reserve) and then respond with the
* status of the reserve. * status of the reserve.
@ -43,11 +43,11 @@
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
int res; int res;
@ -60,13 +60,13 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh,
return MHD_NO; /* internal error */ return MHD_NO; /* internal error */
if (GNUNET_NO == res) if (GNUNET_NO == res)
return MHD_YES; /* parse error */ return MHD_YES; /* parse error */
return TMH_DB_execute_withdraw_status (connection, return TMH_DB_execute_reserve_status (connection,
&reserve_pub); &reserve_pub);
} }
/** /**
* Handle a "/withdraw/sign" request. Parses the "reserve_pub" * Handle a "/reserve/withdraw" request. Parses the "reserve_pub"
* EdDSA key of the reserve and the requested "denom_pub" which * EdDSA key of the reserve and the requested "denom_pub" which
* specifies the key/value of the coin to be withdrawn, and checks * specifies the key/value of the coin to be withdrawn, and checks
* that the signature "reserve_sig" makes this a valid withdrawl * that the signature "reserve_sig" makes this a valid withdrawl
@ -82,11 +82,11 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
json_t *root; json_t *root;
struct TALER_WithdrawRequestPS wsrd; struct TALER_WithdrawRequestPS wsrd;
@ -102,10 +102,15 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh,
struct TMH_KS_StateHandle *ks; struct TMH_KS_StateHandle *ks;
struct TMH_PARSE_FieldSpecification spec[] = { struct TMH_PARSE_FieldSpecification spec[] = {
TMH_PARSE_member_variable ("coin_ev", (void **) &blinded_msg, &blinded_msg_len), TMH_PARSE_member_variable ("coin_ev",
TMH_PARSE_member_fixed ("reserve_pub", &wsrd.reserve_pub), (void **) &blinded_msg,
TMH_PARSE_member_fixed ("reserve_sig", &signature), &blinded_msg_len),
TMH_PARSE_member_denomination_public_key ("denom_pub", &denomination_pub), TMH_PARSE_member_fixed ("reserve_pub",
&wsrd.reserve_pub),
TMH_PARSE_member_fixed ("reserve_sig",
&signature),
TMH_PARSE_member_denomination_public_key ("denom_pub",
&denomination_pub),
TMH_PARSE_MEMBER_END TMH_PARSE_MEMBER_END
}; };
@ -162,19 +167,19 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh,
&signature.eddsa_signature, &signature.eddsa_signature,
&wsrd.reserve_pub.eddsa_pub)) &wsrd.reserve_pub.eddsa_pub))
{ {
TALER_LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n"); TALER_LOG_WARNING ("Client supplied invalid signature for /reserve/withdraw request\n");
TMH_PARSE_release_data (spec); TMH_PARSE_release_data (spec);
return TMH_RESPONSE_reply_signature_invalid (connection, return TMH_RESPONSE_reply_signature_invalid (connection,
"reserve_sig"); "reserve_sig");
} }
res = TMH_DB_execute_withdraw_sign (connection, res = TMH_DB_execute_reserve_withdraw (connection,
&wsrd.reserve_pub, &wsrd.reserve_pub,
&denomination_pub, &denomination_pub,
blinded_msg, blinded_msg,
blinded_msg_len, blinded_msg_len,
&signature); &signature);
TMH_PARSE_release_data (spec); TMH_PARSE_release_data (spec);
return res; return res;
} }
/* end of taler-mint-httpd_withdraw.c */ /* end of taler-mint-httpd_reserve.c */

View File

@ -14,20 +14,20 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file taler-mint-httpd_withdraw.h * @file taler-mint-httpd_reserve.h
* @brief Handle /withdraw/ requests * @brief Handle /reserve/ requests
* @author Florian Dold * @author Florian Dold
* @author Benedikt Mueller * @author Benedikt Mueller
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#ifndef TALER_MINT_HTTPD_WITHDRAW_H #ifndef TALER_MINT_HTTPD_RESERVE_H
#define TALER_MINT_HTTPD_WITHDRAW_H #define TALER_MINT_HTTPD_RESERVE_H
#include <microhttpd.h> #include <microhttpd.h>
#include "taler-mint-httpd.h" #include "taler-mint-httpd.h"
/** /**
* Handle a "/withdraw/status" request. Parses the * Handle a "/reserve/status" request. Parses the
* given "reserve_pub" argument (which should contain the * given "reserve_pub" argument (which should contain the
* EdDSA public key of a reserve) and then respond with the * EdDSA public key of a reserve) and then respond with the
* status of the reserve. * status of the reserve.
@ -40,15 +40,15 @@
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size); size_t *upload_data_size);
/** /**
* Handle a "/withdraw/sign" request. Parses the "reserve_pub" * Handle a "/reserve/withdraw" request. Parses the "reserve_pub"
* EdDSA key of the reserve and the requested "denom_pub" which * EdDSA key of the reserve and the requested "denom_pub" which
* specifies the key/value of the coin to be withdrawn, and checks * specifies the key/value of the coin to be withdrawn, and checks
* that the signature "reserve_sig" makes this a valid withdrawl * that the signature "reserve_sig" makes this a valid withdrawl
@ -64,10 +64,10 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh,
struct MHD_Connection *connection, struct MHD_Connection *connection,
void **connection_cls, void **connection_cls,
const char *upload_data, const char *upload_data,
size_t *upload_data_size); size_t *upload_data_size);
#endif #endif

View File

@ -630,8 +630,8 @@ compile_reserve_history (const struct TALER_MINTDB_ReserveHistory *rh,
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection,
const struct TALER_MINTDB_ReserveHistory *rh) const struct TALER_MINTDB_ReserveHistory *rh)
{ {
json_t *json_balance; json_t *json_balance;
json_t *json_history; json_t *json_history;
@ -654,15 +654,15 @@ TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection,
/** /**
* Send reserve status information to client with the * Send reserve status information to client with the
* message that we have insufficient funds for the * message that we have insufficient funds for the
* requested /withdraw/sign operation. * requested /reserve/withdraw operation.
* *
* @param connection connection to the client * @param connection connection to the client
* @param rh reserve history to return * @param rh reserve history to return
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
const struct TALER_MINTDB_ReserveHistory *rh) const struct TALER_MINTDB_ReserveHistory *rh)
{ {
json_t *json_balance; json_t *json_balance;
json_t *json_history; json_t *json_history;
@ -691,7 +691,7 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection,
const struct TALER_MINTDB_CollectableBlindcoin *collectable) const struct TALER_MINTDB_CollectableBlindcoin *collectable)
{ {
json_t *sig_json; json_t *sig_json;

View File

@ -245,22 +245,22 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection,
const struct TALER_MINTDB_ReserveHistory *rh); const struct TALER_MINTDB_ReserveHistory *rh);
/** /**
* Send reserve status information to client with the * Send reserve status information to client with the
* message that we have insufficient funds for the * message that we have insufficient funds for the
* requested /withdraw/sign operation. * requested /reserve/withdraw operation.
* *
* @param connection connection to the client * @param connection connection to the client
* @param rh reserve history to return * @param rh reserve history to return
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
const struct TALER_MINTDB_ReserveHistory *rh); const struct TALER_MINTDB_ReserveHistory *rh);
/** /**
@ -271,8 +271,8 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn
* @return MHD result code * @return MHD result code
*/ */
int int
TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection, TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection,
const struct TALER_MINTDB_CollectableBlindcoin *collectable); const struct TALER_MINTDB_CollectableBlindcoin *collectable);
/** /**

View File

@ -287,28 +287,28 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of transaction loading"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of transaction loading"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - start"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("27 - /withdraw/sign", PERF_TALER_MINTDB_INIT_CMD_LOOP ("27 - /reserve/withdraw",
NB_WITHDRAW_SAVE), NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - reserve", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - reserve",
"27 - /withdraw/sign", "27 - /reserve/withdraw",
"02 - save reserve"), "02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - dki", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - dki",
"27 - /withdraw/sign", "27 - /reserve/withdraw",
"01 - save denomination"), "01 - save denomination"),
PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN ("", PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN ("",
"27 - dki", "27 - dki",
"27 - reserve"), "27 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"27 - /withdraw/sign"), "27 - /reserve/withdraw"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - end"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - end"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("", PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
"27 - start", "27 - start",
"27 - end", "27 - end",
"POSTGRES", "POSTGRES",
"Number of /withdraw/sign per second", "Number of /reserve/withdraw per second",
"item/sec", "item/sec",
NB_WITHDRAW_SAVE), NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /withdraw/sign"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /reserve/withdraw"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("28 - start"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("28 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("28 - /deposit", PERF_TALER_MINTDB_INIT_CMD_LOOP ("28 - /deposit",

View File

@ -363,7 +363,7 @@
/** /**
* The /withdraw/sign api call * The /reserve/withdraw api call
* *
* Exposes #PERF_TALER_MINTDB_COIN * Exposes #PERF_TALER_MINTDB_COIN
* *

View File

@ -593,7 +593,7 @@ postgres_prepare (PGconn *db_conn)
1, NULL); 1, NULL);
/* Used in #postgres_insert_withdraw_info() to store /* Used in #postgres_insert_withdraw_info() to store
the signature of a blinded coin with the blinded coin's the signature of a blinded coin with the blinded coin's
details before returning it during /withdraw/sign. We store details before returning it during /reserve/withdraw. We store
the coin's denomination information (public key, signature) the coin's denomination information (public key, signature)
and the blinded message as well as the reserve that the coin and the blinded message as well as the reserve that the coin
is being withdrawn from and the signature of the message is being withdrawn from and the signature of the message
@ -616,9 +616,9 @@ postgres_prepare (PGconn *db_conn)
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);", "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);",
12, NULL); 12, NULL);
/* Used in #postgres_get_withdraw_info() to /* Used in #postgres_get_withdraw_info() to
locate the response for a /withdraw/sign request locate the response for a /reserve/withdraw request
using the hash of the blinded message. Used to using the hash of the blinded message. Used to
make sure /withdraw/sign requests are idempotent. */ make sure /reserve/withdraw requests are idempotent. */
PREPARE ("get_withdraw_info", PREPARE ("get_withdraw_info",
"SELECT" "SELECT"
" denom_pub" " denom_pub"
@ -636,7 +636,7 @@ postgres_prepare (PGconn *db_conn)
" WHERE h_blind_ev=$1", " WHERE h_blind_ev=$1",
1, NULL); 1, NULL);
/* Used during #postgres_get_reserve_history() to /* Used during #postgres_get_reserve_history() to
obtain all of the /withdraw/sign operations that obtain all of the /reserve/withdraw operations that
have been performed on a given reserve. (i.e. to have been performed on a given reserve. (i.e. to
demonstrate double-spending) */ demonstrate double-spending) */
PREPARE ("get_reserves_out", PREPARE ("get_reserves_out",
@ -1502,7 +1502,7 @@ postgres_reserves_in_insert (void *cls,
/** /**
* Locate the response for a /withdraw/sign request under the * Locate the response for a /reserve/withdraw request under the
* key of the hash of the blinded message. * key of the hash of the blinded message.
* *
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state