style fixes
This commit is contained in:
parent
9f885f9ad9
commit
bb7bd4b128
@ -63,20 +63,21 @@ reply_deposit_success (struct MHD_Connection *connection,
|
|||||||
const struct TALER_MerchantPublicKeyP *merchant,
|
const struct TALER_MerchantPublicKeyP *merchant,
|
||||||
const struct TALER_Amount *amount_without_fee)
|
const struct TALER_Amount *amount_without_fee)
|
||||||
{
|
{
|
||||||
struct TALER_DepositConfirmationPS dc;
|
|
||||||
struct TALER_ExchangePublicKeyP pub;
|
struct TALER_ExchangePublicKeyP pub;
|
||||||
struct TALER_ExchangeSignatureP sig;
|
struct TALER_ExchangeSignatureP sig;
|
||||||
|
struct TALER_DepositConfirmationPS dc = {
|
||||||
|
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT),
|
||||||
|
.purpose.size = htonl (sizeof (dc)),
|
||||||
|
.h_contract_terms = *h_contract_terms,
|
||||||
|
.h_wire = *h_wire,
|
||||||
|
.timestamp = GNUNET_TIME_absolute_hton (timestamp),
|
||||||
|
.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
|
||||||
|
.coin_pub = *coin_pub,
|
||||||
|
.merchant = *merchant
|
||||||
|
};
|
||||||
|
|
||||||
dc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
|
|
||||||
dc.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
|
|
||||||
dc.h_contract_terms = *h_contract_terms;
|
|
||||||
dc.h_wire = *h_wire;
|
|
||||||
dc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
|
|
||||||
dc.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
|
|
||||||
TALER_amount_hton (&dc.amount_without_fee,
|
TALER_amount_hton (&dc.amount_without_fee,
|
||||||
amount_without_fee);
|
amount_without_fee);
|
||||||
dc.coin_pub = *coin_pub;
|
|
||||||
dc.merchant = *merchant;
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_KS_sign (&dc.purpose,
|
TEH_KS_sign (&dc.purpose,
|
||||||
&pub,
|
&pub,
|
||||||
@ -136,7 +137,6 @@ deposit_transaction (void *cls,
|
|||||||
{
|
{
|
||||||
struct DepositContext *dc = cls;
|
struct DepositContext *dc = cls;
|
||||||
const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
|
const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
|
||||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
|
||||||
struct TALER_Amount spent;
|
struct TALER_Amount spent;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
@ -184,6 +184,9 @@ deposit_transaction (void *cls,
|
|||||||
/* add cost of all previous transactions; skip RECOUP as revoked
|
/* add cost of all previous transactions; skip RECOUP as revoked
|
||||||
denominations are not eligible for deposit, and if we are the old coin
|
denominations are not eligible for deposit, and if we are the old coin
|
||||||
pub of a revoked coin (aka a zombie), then ONLY refresh is allowed. */
|
pub of a revoked coin (aka a zombie), then ONLY refresh is allowed. */
|
||||||
|
{
|
||||||
|
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||||
|
|
||||||
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
|
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
&deposit->coin.coin_pub,
|
&deposit->coin.coin_pub,
|
||||||
@ -193,8 +196,8 @@ deposit_transaction (void *cls,
|
|||||||
return qs;
|
return qs;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_EXCHANGEDB_calculate_transaction_list_totals (tl,
|
TALER_EXCHANGEDB_calculate_transaction_list_totals (tl,
|
||||||
&spent,
|
&spent, /* starting offset */
|
||||||
&spent))
|
&spent /* result */))
|
||||||
{
|
{
|
||||||
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
||||||
tl);
|
tl);
|
||||||
@ -222,6 +225,7 @@ deposit_transaction (void *cls,
|
|||||||
}
|
}
|
||||||
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
||||||
tl);
|
tl);
|
||||||
|
}
|
||||||
qs = TEH_plugin->insert_deposit (TEH_plugin->cls,
|
qs = TEH_plugin->insert_deposit (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
deposit);
|
deposit);
|
||||||
@ -396,7 +400,6 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root)
|
const json_t *root)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
json_t *wire;
|
json_t *wire;
|
||||||
enum TALER_ErrorCode ec;
|
enum TALER_ErrorCode ec;
|
||||||
unsigned int hc;
|
unsigned int hc;
|
||||||
@ -425,6 +428,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
0,
|
0,
|
||||||
sizeof (deposit));
|
sizeof (deposit));
|
||||||
deposit.coin.coin_pub = *coin_pub;
|
deposit.coin.coin_pub = *coin_pub;
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
@ -438,6 +444,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return MHD_YES; /* failure */
|
return MHD_YES; /* failure */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
deposit.receiver_wire_account = wire;
|
deposit.receiver_wire_account = wire;
|
||||||
if (deposit.refund_deadline.abs_value_us > deposit.wire_deadline.abs_value_us)
|
if (deposit.refund_deadline.abs_value_us > deposit.wire_deadline.abs_value_us)
|
||||||
{
|
{
|
||||||
@ -543,25 +550,33 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
/* make sure coin is 'known' in database */
|
/* make sure coin is 'known' in database */
|
||||||
{
|
{
|
||||||
struct TEH_DB_KnowCoinContext kcc;
|
|
||||||
int mhd_ret;
|
int mhd_ret;
|
||||||
|
struct TEH_DB_KnowCoinContext kcc = {
|
||||||
|
.coin = &deposit.coin,
|
||||||
|
.connection = connection
|
||||||
|
};
|
||||||
|
|
||||||
kcc.coin = &deposit.coin;
|
|
||||||
kcc.connection = connection;
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
"know coin for deposit",
|
"know coin for deposit",
|
||||||
&mhd_ret,
|
&mhd_ret,
|
||||||
&TEH_DB_know_coin_transaction,
|
&TEH_DB_know_coin_transaction,
|
||||||
&kcc))
|
&kcc))
|
||||||
|
{
|
||||||
|
GNUNET_JSON_parse_free (spec);
|
||||||
return mhd_ret;
|
return mhd_ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
res = verify_and_execute_deposit (connection,
|
res = verify_and_execute_deposit (connection,
|
||||||
&deposit);
|
&deposit);
|
||||||
GNUNET_JSON_parse_free (spec);
|
GNUNET_JSON_parse_free (spec);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* end of taler-exchange-httpd_deposit.c */
|
/* end of taler-exchange-httpd_deposit.c */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @param tl transaction list to process
|
* @param tl transaction list to process
|
||||||
* @param off offset to use as the starting value
|
* @param off offset to use as the starting value
|
||||||
* @param[out] ret where the resulting total is to be stored
|
* @param[out] ret where the resulting total is to be stored (may alias @a off)
|
||||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -4450,24 +4450,25 @@ postgres_get_coin_transactions (
|
|||||||
&add_coin_recoup_refresh },
|
&add_coin_recoup_refresh },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
struct CoinHistoryContext chc;
|
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_auto_from_type (coin_pub),
|
GNUNET_PQ_query_param_auto_from_type (coin_pub),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
const struct Work *work;
|
const struct Work *work;
|
||||||
|
struct CoinHistoryContext chc = {
|
||||||
|
.head = NULL,
|
||||||
|
.status = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT,
|
||||||
|
.coin_pub = coin_pub,
|
||||||
|
.session = session,
|
||||||
|
.pg = pg,
|
||||||
|
.db_cls = cls
|
||||||
|
};
|
||||||
|
|
||||||
work = (GNUNET_YES == include_recoup) ? work_wp : work_op;
|
work = (GNUNET_YES == include_recoup) ? work_wp : work_op;
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Getting transactions for coin %s\n",
|
"Getting transactions for coin %s\n",
|
||||||
TALER_B2S (coin_pub));
|
TALER_B2S (coin_pub));
|
||||||
chc.head = NULL;
|
|
||||||
chc.status = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
|
||||||
chc.coin_pub = coin_pub;
|
|
||||||
chc.session = session;
|
|
||||||
chc.pg = pg;
|
|
||||||
chc.db_cls = cls;
|
|
||||||
for (unsigned int i = 0; NULL != work[i].statement; i++)
|
for (unsigned int i = 0; NULL != work[i].statement; i++)
|
||||||
{
|
{
|
||||||
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
|
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
|
||||||
|
Loading…
Reference in New Issue
Block a user