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_Amount *amount_without_fee)
|
||||
{
|
||||
struct TALER_DepositConfirmationPS dc;
|
||||
struct TALER_ExchangePublicKeyP pub;
|
||||
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,
|
||||
amount_without_fee);
|
||||
dc.coin_pub = *coin_pub;
|
||||
dc.merchant = *merchant;
|
||||
if (GNUNET_OK !=
|
||||
TEH_KS_sign (&dc.purpose,
|
||||
&pub,
|
||||
@ -136,7 +137,6 @@ deposit_transaction (void *cls,
|
||||
{
|
||||
struct DepositContext *dc = cls;
|
||||
const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
|
||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||
struct TALER_Amount spent;
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
||||
@ -184,6 +184,9 @@ deposit_transaction (void *cls,
|
||||
/* add cost of all previous transactions; skip RECOUP as revoked
|
||||
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. */
|
||||
{
|
||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||
|
||||
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
|
||||
session,
|
||||
&deposit->coin.coin_pub,
|
||||
@ -193,8 +196,8 @@ deposit_transaction (void *cls,
|
||||
return qs;
|
||||
if (GNUNET_OK !=
|
||||
TALER_EXCHANGEDB_calculate_transaction_list_totals (tl,
|
||||
&spent,
|
||||
&spent))
|
||||
&spent, /* starting offset */
|
||||
&spent /* result */))
|
||||
{
|
||||
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
||||
tl);
|
||||
@ -222,6 +225,7 @@ deposit_transaction (void *cls,
|
||||
}
|
||||
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
|
||||
tl);
|
||||
}
|
||||
qs = TEH_plugin->insert_deposit (TEH_plugin->cls,
|
||||
session,
|
||||
deposit);
|
||||
@ -396,7 +400,6 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const json_t *root)
|
||||
{
|
||||
int res;
|
||||
json_t *wire;
|
||||
enum TALER_ErrorCode ec;
|
||||
unsigned int hc;
|
||||
@ -425,6 +428,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
||||
0,
|
||||
sizeof (deposit));
|
||||
deposit.coin.coin_pub = *coin_pub;
|
||||
{
|
||||
int res;
|
||||
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
root,
|
||||
spec);
|
||||
@ -438,6 +444,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
||||
GNUNET_break_op (0);
|
||||
return MHD_YES; /* failure */
|
||||
}
|
||||
}
|
||||
deposit.receiver_wire_account = wire;
|
||||
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 */
|
||||
{
|
||||
struct TEH_DB_KnowCoinContext kcc;
|
||||
int mhd_ret;
|
||||
struct TEH_DB_KnowCoinContext kcc = {
|
||||
.coin = &deposit.coin,
|
||||
.connection = connection
|
||||
};
|
||||
|
||||
kcc.coin = &deposit.coin;
|
||||
kcc.connection = connection;
|
||||
if (GNUNET_OK !=
|
||||
TEH_DB_run_transaction (connection,
|
||||
"know coin for deposit",
|
||||
&mhd_ret,
|
||||
&TEH_DB_know_coin_transaction,
|
||||
&kcc))
|
||||
{
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return mhd_ret;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int res;
|
||||
|
||||
res = verify_and_execute_deposit (connection,
|
||||
&deposit);
|
||||
GNUNET_JSON_parse_free (spec);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* end of taler-exchange-httpd_deposit.c */
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* @param tl transaction list to process
|
||||
* @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
|
||||
*/
|
||||
int
|
||||
|
@ -4450,24 +4450,25 @@ postgres_get_coin_transactions (
|
||||
&add_coin_recoup_refresh },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
struct CoinHistoryContext chc;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (coin_pub),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
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;
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Getting transactions for coin %s\n",
|
||||
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++)
|
||||
{
|
||||
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
|
||||
|
Loading…
Reference in New Issue
Block a user