-rename, as logic is purse deposit specific
This commit is contained in:
parent
9902e88b2d
commit
dc691eb596
@ -25,9 +25,9 @@
|
||||
|
||||
|
||||
enum GNUNET_GenericReturnValue
|
||||
TEH_common_deposit_parse_coin (
|
||||
TEH_common_purse_deposit_parse_coin (
|
||||
struct MHD_Connection *connection,
|
||||
struct TEH_DepositedCoin *coin,
|
||||
struct TEH_PurseDepositedCoin *coin,
|
||||
const json_t *jcoin)
|
||||
{
|
||||
struct GNUNET_JSON_Specification spec[] = {
|
||||
@ -194,7 +194,7 @@ TEH_common_deposit_parse_coin (
|
||||
enum GNUNET_GenericReturnValue
|
||||
TEH_common_deposit_check_purse_deposit (
|
||||
struct MHD_Connection *connection,
|
||||
const struct TEH_DepositedCoin *coin,
|
||||
const struct TEH_PurseDepositedCoin *coin,
|
||||
const struct TALER_PurseContractPublicKeyP *purse_pub,
|
||||
uint32_t min_age)
|
||||
{
|
||||
@ -255,7 +255,7 @@ TEH_common_deposit_check_purse_deposit (
|
||||
* @param[in] coin information to release
|
||||
*/
|
||||
void
|
||||
TEH_common_deposit_free_coin (struct TEH_DepositedCoin *coin)
|
||||
TEH_common_purse_deposit_free_coin (struct TEH_PurseDepositedCoin *coin)
|
||||
{
|
||||
TALER_denom_sig_free (&coin->cpi.denom_sig);
|
||||
if (! coin->cpi.no_age_commitment)
|
||||
|
@ -32,7 +32,7 @@
|
||||
/**
|
||||
* Information about an individual coin being deposited.
|
||||
*/
|
||||
struct TEH_DepositedCoin
|
||||
struct TEH_PurseDepositedCoin
|
||||
{
|
||||
/**
|
||||
* Public information about the coin.
|
||||
@ -93,9 +93,9 @@ struct TEH_DepositedCoin
|
||||
* #GNUNET_SYSERR on failure and no error could be returned
|
||||
*/
|
||||
enum GNUNET_GenericReturnValue
|
||||
TEH_common_deposit_parse_coin (
|
||||
TEH_common_purse_deposit_parse_coin (
|
||||
struct MHD_Connection *connection,
|
||||
struct TEH_DepositedCoin *coin,
|
||||
struct TEH_PurseDepositedCoin *coin,
|
||||
const json_t *jcoin);
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ TEH_common_deposit_parse_coin (
|
||||
enum GNUNET_GenericReturnValue
|
||||
TEH_common_deposit_check_purse_deposit (
|
||||
struct MHD_Connection *connection,
|
||||
const struct TEH_DepositedCoin *coin,
|
||||
const struct TEH_PurseDepositedCoin *coin,
|
||||
const struct TALER_PurseContractPublicKeyP *purse_pub,
|
||||
uint32_t min_age);
|
||||
|
||||
@ -125,6 +125,6 @@ TEH_common_deposit_check_purse_deposit (
|
||||
* @param[in] coin information to release
|
||||
*/
|
||||
void
|
||||
TEH_common_deposit_free_coin (struct TEH_DepositedCoin *coin);
|
||||
TEH_common_purse_deposit_free_coin (struct TEH_PurseDepositedCoin *coin);
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,7 @@ struct PurseCreateContext
|
||||
/**
|
||||
* Array of coins being deposited.
|
||||
*/
|
||||
struct TEH_DepositedCoin *coins;
|
||||
struct TEH_PurseDepositedCoin *coins;
|
||||
|
||||
/**
|
||||
* Length of the @e coins array.
|
||||
@ -258,7 +258,7 @@ create_transaction (void *cls,
|
||||
/* 2) deposit all coins */
|
||||
for (unsigned int i = 0; i<pcc->num_coins; i++)
|
||||
{
|
||||
struct TEH_DepositedCoin *coin = &pcc->coins[i];
|
||||
struct TEH_PurseDepositedCoin *coin = &pcc->coins[i];
|
||||
bool balance_ok = false;
|
||||
bool conflict = true;
|
||||
|
||||
@ -430,15 +430,15 @@ create_transaction (void *cls,
|
||||
static enum GNUNET_GenericReturnValue
|
||||
parse_coin (struct MHD_Connection *connection,
|
||||
struct PurseCreateContext *pcc,
|
||||
struct TEH_DepositedCoin *coin,
|
||||
struct TEH_PurseDepositedCoin *coin,
|
||||
const json_t *jcoin)
|
||||
{
|
||||
enum GNUNET_GenericReturnValue iret;
|
||||
|
||||
if (GNUNET_OK !=
|
||||
(iret = TEH_common_deposit_parse_coin (connection,
|
||||
coin,
|
||||
jcoin)))
|
||||
(iret = TEH_common_purse_deposit_parse_coin (connection,
|
||||
coin,
|
||||
jcoin)))
|
||||
return iret;
|
||||
if (GNUNET_OK !=
|
||||
(iret = TEH_common_deposit_check_purse_deposit (
|
||||
@ -580,11 +580,11 @@ TEH_handler_purses_create (
|
||||
}
|
||||
/* parse deposits */
|
||||
pcc.coins = GNUNET_new_array (pcc.num_coins,
|
||||
struct TEH_DepositedCoin);
|
||||
struct TEH_PurseDepositedCoin);
|
||||
json_array_foreach (deposits, idx, deposit)
|
||||
{
|
||||
enum GNUNET_GenericReturnValue res;
|
||||
struct TEH_DepositedCoin *coin = &pcc.coins[idx];
|
||||
struct TEH_PurseDepositedCoin *coin = &pcc.coins[idx];
|
||||
|
||||
res = parse_coin (connection,
|
||||
&pcc,
|
||||
@ -594,7 +594,7 @@ TEH_handler_purses_create (
|
||||
{
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<idx; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||
}
|
||||
@ -626,7 +626,7 @@ TEH_handler_purses_create (
|
||||
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
@ -644,7 +644,7 @@ TEH_handler_purses_create (
|
||||
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
@ -659,7 +659,7 @@ TEH_handler_purses_create (
|
||||
GNUNET_break (0);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
@ -681,7 +681,7 @@ TEH_handler_purses_create (
|
||||
{
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return mhd_ret;
|
||||
}
|
||||
@ -694,7 +694,7 @@ TEH_handler_purses_create (
|
||||
res = reply_create_success (connection,
|
||||
&pcc);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return res;
|
||||
|
@ -73,7 +73,7 @@ struct PurseDepositContext
|
||||
/**
|
||||
* Array of coins being deposited.
|
||||
*/
|
||||
struct TEH_DepositedCoin *coins;
|
||||
struct TEH_PurseDepositedCoin *coins;
|
||||
|
||||
/**
|
||||
* Length of the @e coins array.
|
||||
@ -163,7 +163,7 @@ deposit_transaction (void *cls,
|
||||
qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
|
||||
for (unsigned int i = 0; i<pcc->num_coins; i++)
|
||||
{
|
||||
struct TEH_DepositedCoin *coin = &pcc->coins[i];
|
||||
struct TEH_PurseDepositedCoin *coin = &pcc->coins[i];
|
||||
bool balance_ok = false;
|
||||
bool conflict = true;
|
||||
|
||||
@ -274,15 +274,15 @@ deposit_transaction (void *cls,
|
||||
static enum GNUNET_GenericReturnValue
|
||||
parse_coin (struct MHD_Connection *connection,
|
||||
struct PurseDepositContext *pcc,
|
||||
struct TEH_DepositedCoin *coin,
|
||||
struct TEH_PurseDepositedCoin *coin,
|
||||
const json_t *jcoin)
|
||||
{
|
||||
enum GNUNET_GenericReturnValue iret;
|
||||
|
||||
if (GNUNET_OK !=
|
||||
(iret = TEH_common_deposit_parse_coin (connection,
|
||||
coin,
|
||||
jcoin)))
|
||||
(iret = TEH_common_purse_deposit_parse_coin (connection,
|
||||
coin,
|
||||
jcoin)))
|
||||
return iret;
|
||||
if (GNUNET_OK !=
|
||||
(iret = TEH_common_deposit_check_purse_deposit (
|
||||
@ -402,11 +402,11 @@ TEH_handler_purses_deposit (
|
||||
|
||||
/* parse deposits */
|
||||
pcc.coins = GNUNET_new_array (pcc.num_coins,
|
||||
struct TEH_DepositedCoin);
|
||||
struct TEH_PurseDepositedCoin);
|
||||
json_array_foreach (deposits, idx, deposit)
|
||||
{
|
||||
enum GNUNET_GenericReturnValue res;
|
||||
struct TEH_DepositedCoin *coin = &pcc.coins[idx];
|
||||
struct TEH_PurseDepositedCoin *coin = &pcc.coins[idx];
|
||||
|
||||
res = parse_coin (connection,
|
||||
&pcc,
|
||||
@ -416,7 +416,7 @@ TEH_handler_purses_deposit (
|
||||
{
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<idx; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||
}
|
||||
@ -428,7 +428,7 @@ TEH_handler_purses_deposit (
|
||||
GNUNET_break (0);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
@ -450,7 +450,7 @@ TEH_handler_purses_deposit (
|
||||
{
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
return mhd_ret;
|
||||
}
|
||||
@ -478,7 +478,7 @@ TEH_handler_purses_deposit (
|
||||
res = reply_deposit_success (connection,
|
||||
&pcc);
|
||||
for (unsigned int i = 0; i<pcc.num_coins; i++)
|
||||
TEH_common_deposit_free_coin (&pcc.coins[i]);
|
||||
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
|
||||
GNUNET_free (pcc.coins);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return res;
|
||||
|
Loading…
Reference in New Issue
Block a user